bridgetown-seo-tag 3.0.1 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a6685265064ebd5142852885d78e6742de4dd93582c143f4ebccb4f5a2158d9
4
- data.tar.gz: 26bfa885b1f3f793868bfe1e1215a2996a0c13d3ac8a5b5961d1e55afaf17e7d
3
+ metadata.gz: 434a7baeaaed55a1dbfb3207e73c5cc940d798742e5ae7ee38166afebe1fe214
4
+ data.tar.gz: 7752c39c3f9663be1ca499534002253110fac0a4491d2b303385d6021a0dabb0
5
5
  SHA512:
6
- metadata.gz: a3971e2c99807cce97a615620d18fbe92ca2d455e62defa8cc996d78c24f629e79edcdab85f8e94141ddce7170749d002aaadd3765b3a1527a60aab40245c384
7
- data.tar.gz: 3c232e55cf817973dbbe86bbf7299beb6af57737ad1c332d4a15da1df1116d610eee7914ce96b68f4c16aab5dada6844a56ea0c033c20f94475003217302caae
6
+ metadata.gz: 3bfccc8df8575bb4aff81e2ef1a09d0e1a85ad9c3cd2061a39d8cac7eee70f886c77aa5d2d655cea6f3cf7624a5f23d52c8ed90b637accb87661f8b4f64ae269
7
+ data.tar.gz: 8cb8348920e0a57da2928b5f43fb27d9d864aa6aadf04d764b280ea39c9620923e6c300edc2d898fd7759a15e4c34b3240358d66325d96b55c085ed11a2fe332
data/.gitignore CHANGED
@@ -7,3 +7,4 @@ spec/reports/
7
7
  spec/fixtures/.bridgetown-cache
8
8
  tmp/
9
9
  vendor/bundle
10
+ .ruby-version
@@ -1,11 +1,11 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- require: rubocop-jekyll
3
+ require: rubocop-bridgetown
4
4
  inherit_gem:
5
- rubocop-jekyll: .rubocop.yml
5
+ rubocop-bridgetown: .rubocop.yml
6
6
 
7
7
  AllCops:
8
- TargetRubyVersion: 2.4
8
+ TargetRubyVersion: 2.5
9
9
  Exclude:
10
10
  - vendor/**/*
11
11
 
@@ -14,6 +14,6 @@ Layout/LineLength:
14
14
  - spec/**/*
15
15
  - bridgetown-seo-tag.gemspec
16
16
 
17
- Layout/BlockLength:
17
+ Metrics/BlockLength:
18
18
  Exclude:
19
19
  - spec/**/*
@@ -0,0 +1,23 @@
1
+ # master
2
+
3
+ ## 3.0.5 / 2020-06-18
4
+
5
+ * Final release
6
+
7
+ ## 3.0.5.beta1 / 2020-05-31
8
+
9
+ * Fix bugs due to Bridgetown 0.15 switch to `render` tag.
10
+ * Switch to using Rubocop Bridgetown gem.
11
+
12
+ ## 3.0.4 / 2020-05-01
13
+
14
+ Update to require a minimum Ruby version of 2.5.
15
+
16
+ ## 3.0.3 / 2020-04-19
17
+
18
+ Allow `site.metadata.twitter` data if present. Look for `page.subtitle` if
19
+ `page.description` isn't present.
20
+
21
+ ## 3.0.0 / 2020-04-14
22
+
23
+ Use Bridgetown gem and rename to bridgetown-seo-tag.
data/README.md CHANGED
@@ -4,31 +4,129 @@ A Bridgetown plugin to add metadata tags for search engines and social networks
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/bridgetown-seo-tag.svg)](https://badge.fury.io/rb/bridgetown-seo-tag)
6
6
 
7
- ## What it does
7
+ ## Installation
8
+
9
+ Run this command to add this plugin to your site's Gemfile:
10
+
11
+ ```shell
12
+ $ bundle add bridgetown-seo-tag -g bridgetown_plugins
13
+ ```
14
+
15
+ Or simply add this line to your Gemfile:
16
+
17
+ ```ruby
18
+ gem 'bridgetown-seo-tag', group: "bridgetown_plugins"
19
+ ```
20
+
21
+ And then add the Liquid tag to your HTML head:
22
+
23
+ ```liquid
24
+ {% seo %}
25
+ ```
26
+
27
+ Or if you wish to control your HTML `<title>` tag yourself:
28
+
29
+ ```liquid
30
+ {% seo title=false %}
31
+ ```
32
+
33
+ ## Summary
8
34
 
9
35
  Bridgetown SEO Tag adds the following meta tags to your site:
10
36
 
11
- * Page title, with site title or description appended
37
+ * Page title, with site title or description appended (optional)
12
38
  * Page description
13
39
  * Canonical URL
14
40
  * Next and previous URLs on paginated pages
15
41
  * [Open Graph](https://ogp.me/) title, description, site title, and URL (for Facebook, LinkedIn, etc.)
16
- * [Twitter Summary Card](https://dev.twitter.com/cards/overview) metadata
42
+ * [Twitter Summary Card](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started) metadata
17
43
 
18
44
  While you could theoretically add the necessary metadata tags yourself, Bridgetown SEO Tag provides a battle-tested template of crowdsourced best-practices.
19
45
 
20
46
  **NOTE:** make sure you add your site-wide SEO Tag metadata to `src/_data/site_metadata.yml`, not `bridgetown.config.yml`
21
47
 
22
- ## What it doesn't do
48
+ ## Usage
49
+
50
+ The SEO tag will use the following configuration options from `bridgetown.config.yml`:
51
+
52
+ * `url` - The full URL to your site.
53
+ * `lang` - The locale for the site, or the current document if specified in the document's front matter. Format `language_TERRITORY` — default is `en_US`.
54
+
55
+ The SEO tag will respect any of the following if included in your site's `site_metadata.yml` (and simply not include them if they're not defined):
56
+
57
+ * `title` - Your website's title (e.g., Super-cool Website).
58
+ * `tagline` - A short description (e.g., A blog dedicated to reviewing cat gifs), used in instances (like a home page) where there isn't a dedicated document title.
59
+ * `description` - A longer description used for the description meta tag. Also used as fallback for documents that don't provide their own `description` and as part of the home page title tag if `tagline` is not defined.
60
+ * `author` - global author information (see [Advanced usage](https://github.com/bridgetownrb/bridgetown-seo-tag/wiki/Advanced-Usage#author-information))
61
+
62
+ * `twitter` - You can add a single Twitter handle to be used in Twitter card tags, like "bridgetownrb". Or you use a YAML mapping with additional details:
63
+ * `twitter:card` - The site's default card type
64
+ * `twitter:username` - The site's Twitter handle
65
+
66
+ Example:
67
+
68
+ ```yml
69
+ twitter:
70
+ username: benbalter
71
+ card: summary
72
+ ```
73
+
74
+ * `facebook` - The following properties are available:
75
+ * `facebook:app_id` - a Facebook app ID for Facebook insights
76
+ * `facebook:publisher` - a Facebook page URL or ID of the publishing entity
77
+ * `facebook:admins` - a Facebook user ID for domain insights linked to a personal account
78
+
79
+ You'll want to describe one or more like so:
80
+
81
+ ```yml
82
+ facebook:
83
+ app_id: 1234
84
+ publisher: 1234
85
+ admins: 1234
86
+ ```
87
+
88
+ * `google_site_verification` for verifying ownership for Google Search Console
89
+ * Alternatively, verify ownership with several services at once using the following format:
90
+
91
+ ```yml
92
+ webmaster_verifications:
93
+ google: 1234
94
+ bing: 1234
95
+ alexa: 1234
96
+ yandex: 1234
97
+ baidu: 1234
98
+ ```
99
+
100
+ The SEO tag will respect the following YAML front matter if included in a post, page, or document:
101
+
102
+ * `title` - The title of the document
103
+ * `description` - A short description of the document's content
104
+ * `image` - URL to an image associated with the document (e.g., `/assets/page-pic.jpg`)
105
+ * `author` - Document-specific author information (see [Advanced usage](https://github.com/bridgetownrb/bridgetown-seo-tag/wiki/Advanced-Usage#author-information))
106
+ * `lang` - Document-specific language information
107
+
108
+ *Note:* Front matter defaults can be used for any of the above values.
109
+
110
+ ### Setting a default image
111
+
112
+ You can define a default image using [Front Matter defaults](https://www.bridgetownrb.com/docs/configuration/front-matter-defaults/) to provide a default Twitter Card or Open Graph image to all of your documents.
23
113
 
24
- Bridgetown SEO tag is designed to output machine-readable metadata for search engines and social networks to index and display.
114
+ Here is a very basic example, that you are encouraged to adapt to your needs:
25
115
 
26
- Bridgetown SEO tag isn't designed to accommodate every possible use case. It should work for most site out of the box and without a laundry list of configuration options that serve only to confuse most users.
116
+ ```yml
117
+ defaults:
118
+ - scope:
119
+ path: ""
120
+ values:
121
+ image: /assets/images/default-card.png
122
+ ```
27
123
 
28
- ## Documentation
124
+ [More advanced usage information is on the Wiki here.](https://github.com/bridgetownrb/bridgetown-seo-tag/wiki/Advanced-Usage)
29
125
 
30
- More detailed documentation forthcoming.
126
+ ## Testing
31
127
 
128
+ * Run `bundle exec rspec` to run the test suite
129
+ * Or run `script/cibuild` to validate with Rubocop and test with rspec together
32
130
 
33
131
  ## Contributing
34
132
 
data/Rakefile CHANGED
@@ -5,4 +5,4 @@ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- task :default => :spec
8
+ task default: :spec
@@ -11,18 +11,16 @@ Gem::Specification.new do |spec|
11
11
  spec.homepage = "https://github.com/bridgetownrb/bridgetown-seo-tag"
12
12
  spec.license = "MIT"
13
13
 
14
- spec.required_ruby_version = ">= 2.4.0"
14
+ spec.required_ruby_version = ">= 2.5.0"
15
15
 
16
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
17
- spec.bindir = "exe"
18
- spec.executables = spec.files.grep(%r!^exe/!) { |f| File.basename(f) }
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features)/!) }
19
17
  spec.require_paths = ["lib"]
20
18
 
21
- spec.add_dependency "bridgetown", ">= 0.6", "< 2.0"
19
+ spec.add_dependency "bridgetown", ">= 0.15.0", "< 2.0"
22
20
 
23
21
  spec.add_development_dependency "bundler", ">= 1.15"
24
- spec.add_development_dependency "rake", "~> 12.0"
25
22
  spec.add_development_dependency "html-proofer", "~> 3.7"
23
+ spec.add_development_dependency "rake", "~> 12.0"
26
24
  spec.add_development_dependency "rspec", "~> 3.5"
27
- spec.add_development_dependency "rubocop-jekyll", "~> 0.5"
25
+ spec.add_development_dependency "rubocop-bridgetown", "~> 0.2"
28
26
  end
@@ -44,27 +44,32 @@ module Bridgetown
44
44
  end
45
45
 
46
46
  def payload
47
+ paginator = context.registers[:page].pager if context.registers[:page].respond_to?(:pager)
48
+
47
49
  # site_payload is an instance of UnifiedPayloadDrop
48
50
  Bridgetown::Utils.deep_merge_hashes(
49
51
  context.registers[:site].site_payload,
50
52
  "page" => context.registers[:page],
51
- "paginator" => context["paginator"],
53
+ "paginator" => paginator,
52
54
  "seo_tag" => drop
53
55
  )
54
56
  end
55
57
 
56
58
  def drop
57
59
  if context.registers[:site].liquid_renderer.respond_to?(:cache)
58
- Bridgetown::SeoTag::Drop.new(@text, @context)
60
+ Bridgetown::SeoTag::Drop.new(@text, context)
59
61
  else
60
- @drop ||= Bridgetown::SeoTag::Drop.new(@text, @context)
62
+ @drop ||= Bridgetown::SeoTag::Drop.new(@text, context)
61
63
  end
62
64
  end
63
65
 
64
66
  def info
65
67
  {
66
- :registers => context.registers,
67
- :filters => [Bridgetown::Filters],
68
+ registers: {
69
+ site: context.registers[:site],
70
+ page: context.registers[:page],
71
+ },
72
+ filters: [Bridgetown::Filters],
68
73
  }
69
74
  end
70
75
 
@@ -31,7 +31,10 @@ module Bridgetown
31
31
  end
32
32
 
33
33
  def site_title
34
- @site_title ||= format_string(site.data.dig("site_metadata", "title") || site.data.dig("site_metadata", "name"))
34
+ @site_title ||= format_string(
35
+ site.data.dig("site_metadata", "title") ||
36
+ site.data.dig("site_metadata", "name")
37
+ )
35
38
  end
36
39
 
37
40
  def site_tagline
@@ -86,19 +89,21 @@ module Bridgetown
86
89
 
87
90
  def description
88
91
  @description ||= begin
89
- format_string(page["description"] || page["excerpt"]) || site_description
92
+ format_string(
93
+ page["description"] || page["subtitle"] || page["excerpt"]
94
+ ) || site_description
90
95
  end
91
96
  end
92
97
 
93
98
  # A drop representing the page author
94
99
  def author
95
- @author ||= AuthorDrop.new(:page => page, :site => site)
100
+ @author ||= AuthorDrop.new(page: page, site: site)
96
101
  end
97
102
 
98
103
  # Returns a Drop representing the page's image
99
104
  # Returns nil if the image has no path, to preserve backwards compatability
100
105
  def image
101
- @image ||= ImageDrop.new(:page => page, :context => @context)
106
+ @image ||= ImageDrop.new(page: page, context: @context)
102
107
  @image if @image.path
103
108
  end
104
109
 
@@ -194,7 +199,7 @@ module Bridgetown
194
199
  total = @context["paginator"]["total_pages"]
195
200
  paginator_message = site["seo_paginator_message"] || "Page %<current>s of %<total>s for "
196
201
 
197
- format(paginator_message, :current => current, :total => total) if current > 1
202
+ format(paginator_message, current: current, total: total) if current > 1
198
203
  end
199
204
 
200
205
  attr_reader :context
@@ -5,6 +5,6 @@ module Liquid; class Tag; end; end
5
5
 
6
6
  module Bridgetown
7
7
  class SeoTag < Liquid::Tag
8
- VERSION = "3.0.1"
8
+ VERSION = "3.0.5"
9
9
  end
10
10
  end
@@ -62,7 +62,7 @@
62
62
  {% endif %}
63
63
 
64
64
  {% if site.metadata.twitter %}
65
- <meta name="twitter:site" content="@{{ site.metadata.twitter.username | remove:'@' }}" />
65
+ <meta name="twitter:site" content="@{{ site.metadata.twitter.username | default: site.metadata.twitter | remove:'@' }}" />
66
66
 
67
67
  {% if seo_tag.author.twitter %}
68
68
  <meta name="twitter:creator" content="@{{ seo_tag.author.twitter | remove:'@' }}" />
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-seo-tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-14 00:00:00.000000000 Z
11
+ date: 2020-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
19
+ version: 0.15.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2.0'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '0.6'
29
+ version: 0.15.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2.0'
@@ -45,33 +45,33 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.15'
47
47
  - !ruby/object:Gem::Dependency
48
- name: rake
48
+ name: html-proofer
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '12.0'
53
+ version: '3.7'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '12.0'
60
+ version: '3.7'
61
61
  - !ruby/object:Gem::Dependency
62
- name: html-proofer
62
+ name: rake
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '3.7'
67
+ version: '12.0'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '3.7'
74
+ version: '12.0'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rspec
77
77
  requirement: !ruby/object:Gem::Requirement
@@ -87,19 +87,19 @@ dependencies:
87
87
  - !ruby/object:Gem::Version
88
88
  version: '3.5'
89
89
  - !ruby/object:Gem::Dependency
90
- name: rubocop-jekyll
90
+ name: rubocop-bridgetown
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '0.5'
95
+ version: '0.2'
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: '0.5'
102
+ version: '0.2'
103
103
  description:
104
104
  email: maintainers@bridgetownrb.com
105
105
  executables: []
@@ -110,8 +110,8 @@ files:
110
110
  - ".rspec"
111
111
  - ".rubocop.yml"
112
112
  - ".rubocop_todo.yml"
113
+ - CHANGELOG.md
113
114
  - Gemfile
114
- - History.markdown
115
115
  - LICENSE.txt
116
116
  - README.md
117
117
  - Rakefile
@@ -124,11 +124,6 @@ files:
124
124
  - lib/bridgetown-seo-tag/url_helper.rb
125
125
  - lib/bridgetown-seo-tag/version.rb
126
126
  - lib/template.html
127
- - script/bootstrap
128
- - script/cibuild
129
- - script/fmt
130
- - script/release
131
- - script/test
132
127
  homepage: https://github.com/bridgetownrb/bridgetown-seo-tag
133
128
  licenses:
134
129
  - MIT
@@ -141,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
136
  requirements:
142
137
  - - ">="
143
138
  - !ruby/object:Gem::Version
144
- version: 2.4.0
139
+ version: 2.5.0
145
140
  required_rubygems_version: !ruby/object:Gem::Requirement
146
141
  requirements:
147
142
  - - ">="
@@ -1,5 +0,0 @@
1
- # Change Log
2
-
3
- ## 3.0.0 / 2020-04-14
4
-
5
- Use Bridgetown gem and rename to bridgetown-seo-tag.
@@ -1,5 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -ex
4
-
5
- bundle install
@@ -1,6 +0,0 @@
1
- #!/bin/sh
2
-
3
- set -ex
4
-
5
- script/fmt
6
- script/test
data/script/fmt DELETED
@@ -1,10 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- echo "Rubocop $(bundle exec rubocop --version)"
5
- bundle exec rubocop -D -E $@
6
- success=$?
7
- if ((success != 0)); then
8
- echo -e "\nTry running \`script/fmt -a\` to automatically fix errors"
9
- fi
10
- exit $success
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
- # Tag and push a release.
3
-
4
- set -e
5
-
6
- script/cibuild
7
- bundle exec rake release
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
- set -ex
3
-
4
- bundle exec rspec "$@"