bridgetown-seo-tag 3.0.0 → 3.0.5.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +106 -8
- data/Rakefile +1 -1
- data/bridgetown-seo-tag.gemspec +7 -9
- data/lib/bridgetown-seo-tag.rb +10 -5
- data/lib/bridgetown-seo-tag/drop.rb +10 -5
- data/lib/bridgetown-seo-tag/version.rb +1 -1
- data/lib/template.html +1 -1
- metadata +20 -26
- data/History.markdown +0 -5
- data/script/bootstrap +0 -5
- data/script/cibuild +0 -6
- data/script/fmt +0 -10
- data/script/release +0 -7
- data/script/test +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fb136d90e02d2d69b5269ffbe7464a4cbe3e123e2a3c7ac718e6fc27243cc82
|
4
|
+
data.tar.gz: 035d0bc9e0dd579d93ce3dd27c53301cfcd9aa9d81659ed3819fd535a2a15983
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36cedb645d26109e2555ee02c1ca0c538c7de4e4ceec99716b3c14b9e4c208d4135af7245fb00e4aeaf7b0366d6b111f6639e34e99cd089c853e389a0c14d888
|
7
|
+
data.tar.gz: 40fbbf1462cfff3c55655584447b7271e69d49395c7da35e92e993bc0bf60e32ed12fc22efb1a79eda86b458e61390a72f6e785857a9731918d2e318534a8057
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
|
-
require: rubocop-
|
3
|
+
require: rubocop-bridgetown
|
4
4
|
inherit_gem:
|
5
|
-
rubocop-
|
5
|
+
rubocop-bridgetown: .rubocop.yml
|
6
6
|
|
7
7
|
AllCops:
|
8
|
-
TargetRubyVersion: 2.
|
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
|
-
|
17
|
+
Metrics/BlockLength:
|
18
18
|
Exclude:
|
19
19
|
- spec/**/*
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# master
|
2
|
+
|
3
|
+
## 3.0.5.beta1 / 2020-05-31
|
4
|
+
|
5
|
+
* Fix bugs due to Bridgetown 0.15 switch to `render` tag.
|
6
|
+
* Switch to using Rubocop Bridgetown gem.
|
7
|
+
|
8
|
+
## 3.0.4 / 2020-05-01
|
9
|
+
|
10
|
+
Update to require a minimum Ruby version of 2.5.
|
11
|
+
|
12
|
+
## 3.0.3 / 2020-04-19
|
13
|
+
|
14
|
+
Allow `site.metadata.twitter` data if present. Look for `page.subtitle` if
|
15
|
+
`page.description` isn't present.
|
16
|
+
|
17
|
+
## 3.0.0 / 2020-04-14
|
18
|
+
|
19
|
+
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
|
-
##
|
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://
|
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
|
-
##
|
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
|
-
|
114
|
+
Here is a very basic example, that you are encouraged to adapt to your needs:
|
25
115
|
|
26
|
-
|
116
|
+
```yml
|
117
|
+
defaults:
|
118
|
+
- scope:
|
119
|
+
path: ""
|
120
|
+
values:
|
121
|
+
image: /assets/images/default-card.png
|
122
|
+
```
|
27
123
|
|
28
|
-
|
124
|
+
[More advanced usage information is on the Wiki here.](https://github.com/bridgetownrb/bridgetown-seo-tag/wiki/Advanced-Usage)
|
29
125
|
|
30
|
-
|
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
data/bridgetown-seo-tag.gemspec
CHANGED
@@ -5,24 +5,22 @@ require_relative "lib/bridgetown-seo-tag/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "bridgetown-seo-tag"
|
7
7
|
spec.version = Bridgetown::SeoTag::VERSION
|
8
|
-
spec.
|
9
|
-
spec.email =
|
8
|
+
spec.author = "Bridgetown Team"
|
9
|
+
spec.email = "maintainers@bridgetownrb.com"
|
10
10
|
spec.summary = "A Bridgetown plugin to add metadata tags for search engines and social networks to better index and display your site's content."
|
11
11
|
spec.homepage = "https://github.com/bridgetownrb/bridgetown-seo-tag"
|
12
12
|
spec.license = "MIT"
|
13
13
|
|
14
|
-
spec.required_ruby_version = ">= 2.
|
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.
|
19
|
+
spec.add_dependency "bridgetown", ">= 0.15.0.beta2", "< 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-
|
25
|
+
spec.add_development_dependency "rubocop-bridgetown", "~> 0.2"
|
28
26
|
end
|
data/lib/bridgetown-seo-tag.rb
CHANGED
@@ -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" =>
|
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,
|
60
|
+
Bridgetown::SeoTag::Drop.new(@text, context)
|
59
61
|
else
|
60
|
-
@drop ||= Bridgetown::SeoTag::Drop.new(@text,
|
62
|
+
@drop ||= Bridgetown::SeoTag::Drop.new(@text, context)
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
64
66
|
def info
|
65
67
|
{
|
66
|
-
:
|
67
|
-
|
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(
|
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(
|
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(:
|
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(:
|
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, :
|
202
|
+
format(paginator_message, current: current, total: total) if current > 1
|
198
203
|
end
|
199
204
|
|
200
205
|
attr_reader :context
|
data/lib/template.html
CHANGED
@@ -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.
|
4
|
+
version: 3.0.5.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Bridgetown Team
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-31 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:
|
19
|
+
version: 0.15.0.beta2
|
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:
|
29
|
+
version: 0.15.0.beta2
|
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:
|
48
|
+
name: html-proofer
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
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: '
|
60
|
+
version: '3.7'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
62
|
+
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
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: '
|
74
|
+
version: '12.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rspec
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,22 +87,21 @@ dependencies:
|
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '3.5'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
|
-
name: rubocop-
|
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.
|
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.
|
102
|
+
version: '0.2'
|
103
103
|
description:
|
104
|
-
email:
|
105
|
-
- ben.balter@github.com
|
104
|
+
email: maintainers@bridgetownrb.com
|
106
105
|
executables: []
|
107
106
|
extensions: []
|
108
107
|
extra_rdoc_files: []
|
@@ -111,8 +110,8 @@ files:
|
|
111
110
|
- ".rspec"
|
112
111
|
- ".rubocop.yml"
|
113
112
|
- ".rubocop_todo.yml"
|
113
|
+
- CHANGELOG.md
|
114
114
|
- Gemfile
|
115
|
-
- History.markdown
|
116
115
|
- LICENSE.txt
|
117
116
|
- README.md
|
118
117
|
- Rakefile
|
@@ -125,11 +124,6 @@ files:
|
|
125
124
|
- lib/bridgetown-seo-tag/url_helper.rb
|
126
125
|
- lib/bridgetown-seo-tag/version.rb
|
127
126
|
- lib/template.html
|
128
|
-
- script/bootstrap
|
129
|
-
- script/cibuild
|
130
|
-
- script/fmt
|
131
|
-
- script/release
|
132
|
-
- script/test
|
133
127
|
homepage: https://github.com/bridgetownrb/bridgetown-seo-tag
|
134
128
|
licenses:
|
135
129
|
- MIT
|
@@ -142,12 +136,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
136
|
requirements:
|
143
137
|
- - ">="
|
144
138
|
- !ruby/object:Gem::Version
|
145
|
-
version: 2.
|
139
|
+
version: 2.5.0
|
146
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
141
|
requirements:
|
148
|
-
- - "
|
142
|
+
- - ">"
|
149
143
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
144
|
+
version: 1.3.1
|
151
145
|
requirements: []
|
152
146
|
rubygems_version: 3.0.6
|
153
147
|
signing_key:
|
data/History.markdown
DELETED
data/script/cibuild
DELETED
data/script/fmt
DELETED
data/script/release
DELETED
data/script/test
DELETED