jekyll-seo-tag 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +70 -1
- data/lib/jekyll-seo-tag.rb +20 -5
- data/lib/jekyll-seo-tag/version.rb +1 -1
- data/lib/template.html +15 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24b1466116c0edcefb7df6ea675eca5d08735626
|
4
|
+
data.tar.gz: 3effdcadd767625bd1418d1f3c0d36a3b50c7a13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f39e1738e4cdaab1fe7aa0fe139f6fba9fa2479dcb0a0d5167d5132f444e3eae04d0afff321cb58c1f93b5bf666cd9d94c250c73b7779ca7d3f68021882b4007
|
7
|
+
data.tar.gz: a3888cf97e85b7a66461a225d68e54048a95caeaa039dbb9f3c9e74a18113f5fa46210650f5f251414c7f5a0e6a985d429ef2621f8e671b7b9b50ffcb808fd5f
|
data/README.md
CHANGED
@@ -52,17 +52,22 @@ The SEO tag will respect any of the following if included in your site's `_confi
|
|
52
52
|
* `title` - Your site's title (e.g., Ben's awesome site, The GitHub Blog, etc.)
|
53
53
|
* `description` - A short description (e.g., A blog dedicated to reviewing cat gifs)
|
54
54
|
* `url` - The full URL to your site. Note: `site.github.url` will be used by default.
|
55
|
+
* `author` - global author information (see below)
|
55
56
|
* `twitter:username` - The site's Twitter handle. You'll want to describe it like so:
|
57
|
+
|
56
58
|
```yml
|
57
59
|
twitter:
|
58
60
|
username: benbalter
|
59
61
|
```
|
62
|
+
|
60
63
|
* `facebook:app_id` (A Facebook app ID for Facebook insights), and/or `facebook:publisher` (A Facebook page URL or ID of the publishing entity). You'll want to describe one or both like so:
|
64
|
+
|
61
65
|
```yml
|
62
66
|
facebook:
|
63
67
|
app_id: 1234
|
64
68
|
publisher: 1234
|
65
69
|
```
|
70
|
+
|
66
71
|
* `logo` - Relative URL to a site-wide logo (e.g., `assets/your-company-logo.png`)
|
67
72
|
* `social` - For [specifying social profiles](https://developers.google.com/structured-data/customize/social-profiles). The following properties are available:
|
68
73
|
* `type` - Either `person` or `organization` (defaults to `person`)
|
@@ -75,4 +80,68 @@ The SEO tag will respect the following YAML front matter if included in a post,
|
|
75
80
|
* `title` - The title of the post, page, or document
|
76
81
|
* `description` - A short description of the page's content
|
77
82
|
* `image` - Relative URL to an image associated with the post, page, or document (e.g., `assets/page-pic.jpg`)
|
78
|
-
* `author` -
|
83
|
+
* `author` - Page-, post-, or document-specific author information (see below)
|
84
|
+
|
85
|
+
### Disabling `<title>` output
|
86
|
+
|
87
|
+
Jekyll SEO Tag is designed to implement SEO best practices by default. If for some reason, you don't want the plugin to output `<title>` tags on each page, simply invoke the plugin within your template like so:
|
88
|
+
|
89
|
+
```
|
90
|
+
{% seo title=false %}
|
91
|
+
```
|
92
|
+
|
93
|
+
### Author information
|
94
|
+
|
95
|
+
Author information is used to propagate the `creator` field of Twitter summary cards. This is should be an author-specific, not site-wide Twitter handle (the site-wide username be stored as `site.twitter.username`).
|
96
|
+
|
97
|
+
*TL;DR: In most cases, put `author: [your Twitter handle]` in the document's front matter, for sites with multiple authors. If you need something more complicated, read on.*
|
98
|
+
|
99
|
+
There are several ways to convey this author-specific information. Author information is found in the following order of priority:
|
100
|
+
|
101
|
+
1. An `author` object, in the documents's front matter, e.g.:
|
102
|
+
|
103
|
+
```yml
|
104
|
+
author:
|
105
|
+
twitter: benbalter
|
106
|
+
```
|
107
|
+
|
108
|
+
2. An `author` object, in the site's `_config.yml`, e.g.:
|
109
|
+
|
110
|
+
```yml
|
111
|
+
author:
|
112
|
+
twitter: benbalter
|
113
|
+
```
|
114
|
+
|
115
|
+
3. `site.data.authors[author]`, if an author is specified in the document's front matter, and a corresponding key exists in `site.data.authors`. E.g., you have the following in the document's front matter:
|
116
|
+
|
117
|
+
```yml
|
118
|
+
author: benbalter
|
119
|
+
```
|
120
|
+
|
121
|
+
And you have the following in `_data/authors.yml`:
|
122
|
+
|
123
|
+
```yml
|
124
|
+
benbalter:
|
125
|
+
picture: /img/benbalter.png
|
126
|
+
twitter: jekyllrb
|
127
|
+
|
128
|
+
potus:
|
129
|
+
picture: /img/potus.png
|
130
|
+
twitter: whitehouse
|
131
|
+
```
|
132
|
+
|
133
|
+
In the above example, the author `benbalter`'s Twitter handle will be resolved to `@jekyllrb`. This allows you to centralize author information in a single `_data/authors` file for site with many authors that require more than just the author's username.
|
134
|
+
|
135
|
+
*Pro-tip: If `authors` is present in the document's front matter as an array (and `author` is not), the plugin will use the first author listed, as Twitter supports only one author.*
|
136
|
+
|
137
|
+
4. An author in the document's front matter (the simplest way), e.g.:
|
138
|
+
|
139
|
+
```yml
|
140
|
+
author: benbalter
|
141
|
+
```
|
142
|
+
|
143
|
+
5. An author in the site's `_config.yml`, e.g.:
|
144
|
+
|
145
|
+
```yml
|
146
|
+
author: benbalter
|
147
|
+
```
|
data/lib/jekyll-seo-tag.rb
CHANGED
@@ -6,22 +6,37 @@ module Jekyll
|
|
6
6
|
|
7
7
|
MINIFY_REGEX = /(>\n|[%}]})\s+(<|{[{%])/
|
8
8
|
|
9
|
+
def initialize(_tag_name, text, _tokens)
|
10
|
+
super
|
11
|
+
@text = text
|
12
|
+
end
|
13
|
+
|
9
14
|
def render(context)
|
10
15
|
@context = context
|
11
|
-
|
12
|
-
|
13
|
-
output
|
16
|
+
template.render!(payload, info)
|
14
17
|
end
|
15
18
|
|
16
19
|
private
|
17
20
|
|
21
|
+
def options
|
22
|
+
{
|
23
|
+
'version' => VERSION,
|
24
|
+
'title' => title?
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
18
28
|
def payload
|
19
29
|
{
|
20
|
-
'page'
|
21
|
-
'site'
|
30
|
+
'page' => context.registers[:page],
|
31
|
+
'site' => context.registers[:site].site_payload['site'],
|
32
|
+
'seo_tag' => options
|
22
33
|
}
|
23
34
|
end
|
24
35
|
|
36
|
+
def title?
|
37
|
+
!(@text =~ /title=false/i)
|
38
|
+
end
|
39
|
+
|
25
40
|
def info
|
26
41
|
{
|
27
42
|
registers: context.registers,
|
data/lib/template.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<!-- Begin Jekyll SEO tag -->
|
1
|
+
<!-- Begin Jekyll SEO tag v{{ seo_tag.version }} -->
|
2
2
|
|
3
3
|
{% if site.url %}
|
4
4
|
{% assign seo_url = site.url | append: site.baseurl %}
|
@@ -39,16 +39,21 @@
|
|
39
39
|
{% assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once %}
|
40
40
|
{% endif %}
|
41
41
|
|
42
|
-
{%
|
43
|
-
|
44
|
-
{%
|
45
|
-
{%
|
46
|
-
|
47
|
-
{% if
|
48
|
-
|
42
|
+
{% assign seo_author = page.author | default: page.authors[0] | default: site.author %}
|
43
|
+
{% if seo_author %}
|
44
|
+
{% if seo_author.twitter %}
|
45
|
+
{% assign seo_author_twitter = seo_author.twitter %}
|
46
|
+
{% else %}
|
47
|
+
{% if site.data.authors and site.data.authors[seo_author] %}
|
48
|
+
{% assign seo_author_twitter = site.data.authors[seo_author].twitter %}
|
49
|
+
{% else %}
|
50
|
+
{% assign seo_author_twitter = seo_author %}
|
51
|
+
{% endif %}
|
52
|
+
{% endif %}
|
53
|
+
{% assign seo_author_twitter = seo_author_twitter | replace:"@","" %}
|
49
54
|
{% endif %}
|
50
55
|
|
51
|
-
{% if seo_title %}
|
56
|
+
{% if seo_tag.title and seo_title %}
|
52
57
|
<title>{{ seo_title }}</title>
|
53
58
|
{% endif %}
|
54
59
|
|
@@ -117,7 +122,7 @@
|
|
117
122
|
{% endif %}
|
118
123
|
|
119
124
|
{% if seo_author_twitter %}
|
120
|
-
<meta name="twitter:creator" content="{{ seo_author_twitter }}" />
|
125
|
+
<meta name="twitter:creator" content="@{{ seo_author_twitter }}" />
|
121
126
|
{% endif %}
|
122
127
|
{% endif %}
|
123
128
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-seo-tag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|