bridgetown-seo-tag 3.0.4 → 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/.rubocop.yml +3 -3
- data/CHANGELOG.md +5 -0
- data/README.md +82 -8
- data/Rakefile +1 -1
- data/bridgetown-seo-tag.gemspec +2 -2
- data/lib/bridgetown-seo-tag.rb +10 -5
- data/lib/bridgetown-seo-tag/drop.rb +3 -3
- data/lib/bridgetown-seo-tag/version.rb +1 -1
- metadata +9 -9
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/.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
|
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -24,30 +24,104 @@ And then add the Liquid tag to your HTML head:
|
|
24
24
|
{% seo %}
|
25
25
|
```
|
26
26
|
|
27
|
-
|
27
|
+
Or if you wish to control your HTML `<title>` tag yourself:
|
28
|
+
|
29
|
+
```liquid
|
30
|
+
{% seo title=false %}
|
31
|
+
```
|
32
|
+
|
33
|
+
## Summary
|
28
34
|
|
29
35
|
Bridgetown SEO Tag adds the following meta tags to your site:
|
30
36
|
|
31
|
-
* Page title, with site title or description appended
|
37
|
+
* Page title, with site title or description appended (optional)
|
32
38
|
* Page description
|
33
39
|
* Canonical URL
|
34
40
|
* Next and previous URLs on paginated pages
|
35
41
|
* [Open Graph](https://ogp.me/) title, description, site title, and URL (for Facebook, LinkedIn, etc.)
|
36
|
-
* [Twitter Summary Card](https://
|
42
|
+
* [Twitter Summary Card](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/getting-started) metadata
|
37
43
|
|
38
44
|
While you could theoretically add the necessary metadata tags yourself, Bridgetown SEO Tag provides a battle-tested template of crowdsourced best-practices.
|
39
45
|
|
40
46
|
**NOTE:** make sure you add your site-wide SEO Tag metadata to `src/_data/site_metadata.yml`, not `bridgetown.config.yml`
|
41
47
|
|
42
|
-
##
|
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
|
+
```
|
43
73
|
|
44
|
-
|
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
|
45
78
|
|
46
|
-
|
79
|
+
You'll want to describe one or more like so:
|
47
80
|
|
48
|
-
|
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.
|
113
|
+
|
114
|
+
Here is a very basic example, that you are encouraged to adapt to your needs:
|
115
|
+
|
116
|
+
```yml
|
117
|
+
defaults:
|
118
|
+
- scope:
|
119
|
+
path: ""
|
120
|
+
values:
|
121
|
+
image: /assets/images/default-card.png
|
122
|
+
```
|
49
123
|
|
50
|
-
More
|
124
|
+
[More advanced usage information is on the Wiki here.](https://github.com/bridgetownrb/bridgetown-seo-tag/wiki/Advanced-Usage)
|
51
125
|
|
52
126
|
## Testing
|
53
127
|
|
data/Rakefile
CHANGED
data/bridgetown-seo-tag.gemspec
CHANGED
@@ -16,11 +16,11 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features)/!) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_dependency "bridgetown", ">= 0.
|
19
|
+
spec.add_dependency "bridgetown", ">= 0.15.0.beta2", "< 2.0"
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", ">= 1.15"
|
22
22
|
spec.add_development_dependency "html-proofer", "~> 3.7"
|
23
23
|
spec.add_development_dependency "rake", "~> 12.0"
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.5"
|
25
|
-
spec.add_development_dependency "rubocop-
|
25
|
+
spec.add_development_dependency "rubocop-bridgetown", "~> 0.2"
|
26
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
|
|
@@ -97,13 +97,13 @@ module Bridgetown
|
|
97
97
|
|
98
98
|
# A drop representing the page author
|
99
99
|
def author
|
100
|
-
@author ||= AuthorDrop.new(:
|
100
|
+
@author ||= AuthorDrop.new(page: page, site: site)
|
101
101
|
end
|
102
102
|
|
103
103
|
# Returns a Drop representing the page's image
|
104
104
|
# Returns nil if the image has no path, to preserve backwards compatability
|
105
105
|
def image
|
106
|
-
@image ||= ImageDrop.new(:
|
106
|
+
@image ||= ImageDrop.new(page: page, context: @context)
|
107
107
|
@image if @image.path
|
108
108
|
end
|
109
109
|
|
@@ -199,7 +199,7 @@ module Bridgetown
|
|
199
199
|
total = @context["paginator"]["total_pages"]
|
200
200
|
paginator_message = site["seo_paginator_message"] || "Page %<current>s of %<total>s for "
|
201
201
|
|
202
|
-
format(paginator_message, :
|
202
|
+
format(paginator_message, current: current, total: total) if current > 1
|
203
203
|
end
|
204
204
|
|
205
205
|
attr_reader :context
|
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
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
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'
|
@@ -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-
|
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
104
|
email: maintainers@bridgetownrb.com
|
105
105
|
executables: []
|
@@ -139,9 +139,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: 2.5.0
|
140
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
|
-
- - "
|
142
|
+
- - ">"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
144
|
+
version: 1.3.1
|
145
145
|
requirements: []
|
146
146
|
rubygems_version: 3.0.6
|
147
147
|
signing_key:
|