bunto-seo-tag 5.0.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +12 -10
- data/.rspec +2 -2
- data/.rubocop.yml +25 -10
- data/.travis.yml +12 -12
- data/Gemfile +7 -16
- data/LICENSE.txt +21 -21
- data/bunto-seo-tag.gemspec +34 -34
- data/docs/README.md +33 -0
- data/docs/_config.yml +10 -0
- data/docs/_layouts/default.html +18 -0
- data/docs/advanced-usage.md +138 -0
- data/docs/installation.md +20 -0
- data/docs/usage.md +67 -0
- data/lib/bunto-seo-tag.rb +80 -66
- data/lib/bunto-seo-tag/drop.rb +280 -0
- data/lib/bunto-seo-tag/filters.rb +12 -13
- data/lib/bunto-seo-tag/json_ld.rb +79 -0
- data/lib/bunto-seo-tag/version.rb +8 -8
- data/lib/template.html +104 -202
- data/script/bootstrap +5 -5
- data/script/cibuild +7 -7
- data/script/release +38 -38
- data/script/site +3 -0
- metadata +39 -45
- data/README.md +0 -155
- data/Rakefile +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 216785d368b04b4f537ebaac9b0acd30d9558baa
|
4
|
+
data.tar.gz: 1e5632910a531af2629ca9236309e269db65818d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff65e4c12a0d592d3d3f1a0d46aa666ab9abea21f4b4fd74bda4f7fdca854f4b83ddcb895b89c2ef0f7c66fd0b40d5430f10b051ab10e950b3e828c275233684
|
7
|
+
data.tar.gz: aee2b56e22f328eb7d25be10ce68247f79aae2ad73d1b29521469df8ef45126cbe51b29ff06023b32277064f2e1d6b0ebeac3526caf0d887887729f2dede2e27
|
data/.gitignore
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/Gemfile.lock
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
10
|
-
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
/bin/
|
11
|
+
*.gem
|
12
|
+
_site
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--
|
2
|
-
--
|
1
|
+
--color
|
2
|
+
--require spec_helper
|
data/.rubocop.yml
CHANGED
@@ -1,10 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
inherit_gem:
|
2
|
+
bunto: .rubocop.yml
|
3
|
+
|
4
|
+
Metrics/LineLength:
|
5
|
+
Exclude:
|
6
|
+
- spec/**/*
|
7
|
+
- bunto-seo-tag.gemspec
|
8
|
+
|
9
|
+
Metrics/BlockLength:
|
10
|
+
Exclude:
|
11
|
+
- spec/**/*
|
12
|
+
|
13
|
+
Style/Documentation:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/FileName:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Style/IndentHeredoc:
|
20
|
+
Exclude:
|
21
|
+
- spec/**/*
|
22
|
+
|
23
|
+
AllCops:
|
24
|
+
Exclude:
|
25
|
+
- vendor/**/*
|
data/.travis.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
- chmod a+x script/
|
7
|
-
- chmod a+x script/
|
8
|
-
- chmod a+x script/
|
9
|
-
|
10
|
-
script: script/cibuild
|
11
|
-
sudo: false
|
12
|
-
cache: bundler
|
1
|
+
rvm:
|
2
|
+
- 2.2.3
|
3
|
+
before_install:
|
4
|
+
- gem install bundler
|
5
|
+
- chmod a+x script/bootstrap
|
6
|
+
- chmod a+x script/cibuild
|
7
|
+
- chmod a+x script/release
|
8
|
+
- chmod a+x script/site
|
9
|
+
language: ruby
|
10
|
+
script: script/cibuild
|
11
|
+
sudo: false
|
12
|
+
cache: bundler
|
data/Gemfile
CHANGED
@@ -1,16 +1,7 @@
|
|
1
|
-
source
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
5
|
-
gemspec
|
6
|
-
|
7
|
-
|
8
|
-
versions = JSON.parse(open('https://pages.github.com/versions.json').read)
|
9
|
-
versions.delete('ruby')
|
10
|
-
versions.delete('bunto-seo-tag')
|
11
|
-
versions.delete('github-pages')
|
12
|
-
|
13
|
-
versions.each do |dep, version|
|
14
|
-
gem dep, version
|
15
|
-
end
|
16
|
-
end
|
1
|
+
source "https://rubygems.org"
|
2
|
+
require "json"
|
3
|
+
require "open-uri"
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
gem "github-pages", :group => :bunto_plugins
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c)
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015-present Ben Balter
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/bunto-seo-tag.gemspec
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
spec.
|
9
|
-
spec.
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
spec.
|
14
|
-
|
15
|
-
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
spec.
|
25
|
-
spec.
|
26
|
-
spec.
|
27
|
-
|
28
|
-
|
29
|
-
spec.
|
30
|
-
spec.add_development_dependency
|
31
|
-
spec.add_development_dependency
|
32
|
-
spec.add_development_dependency
|
33
|
-
spec.add_development_dependency
|
34
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "bunto-seo-tag/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "bunto-seo-tag"
|
9
|
+
spec.version = Bunto::SeoTag::VERSION
|
10
|
+
spec.authors = ["Ben Balter", "Suriyaa Kudo"]
|
11
|
+
spec.email = ["ben.balter@github.com", "github@suriyaa.tk"]
|
12
|
+
spec.summary = "A Bunto plugin to add metadata tags for search engines and social networks to better index and display your site's content."
|
13
|
+
spec.homepage = "https://github.com/bunto/bunto-seo-tag"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r!^exe/!) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency "bunto", "~> 3.4"
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
31
|
+
spec.add_development_dependency "rspec", "~> 3.5"
|
32
|
+
spec.add_development_dependency "html-proofer", "~> 3.6"
|
33
|
+
spec.add_development_dependency "rubocop", "~> 0.48"
|
34
|
+
end
|
data/docs/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
## About Bunto SEO Tag
|
2
|
+
|
3
|
+
A Bunto plugin to add metadata tags for search engines and social networks to better index and display your site's content.
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/bunto-seo-tag.svg)](https://badge.fury.io/rb/bunto-seo-tag) [![Build Status](https://travis-ci.org/bunto/bunto-seo-tag.svg)](https://travis-ci.org/bunto/bunto-seo-tag)
|
6
|
+
|
7
|
+
## What it does
|
8
|
+
|
9
|
+
Bunto SEO Tag adds the following meta tags to your site:
|
10
|
+
|
11
|
+
* Page title, with site title or description appended
|
12
|
+
* Page description
|
13
|
+
* Canonical URL
|
14
|
+
* Next and previous URLs on paginated pages
|
15
|
+
* [JSON-LD Site and post metadata](https://developers.google.com/structured-data/) for richer indexing
|
16
|
+
* [Open Graph](http://ogp.me/) title, description, site title, and URL (for Facebook, LinkedIn, etc.)
|
17
|
+
* [Twitter Summary Card](https://dev.twitter.com/cards/overview) metadata
|
18
|
+
|
19
|
+
While you could theoretically add the necessary metadata tags yourself, Bunto SEO Tag provides a battle-tested template of crowdsourced best-practices.
|
20
|
+
|
21
|
+
## What it doesn't do
|
22
|
+
|
23
|
+
Bunto SEO tag is designed to output machine-readable metadata for search engines and social networks to index and display. If you're looking for something to analyze your Bunto site's structure and content (e.g., more traditional SEO optimization), take a look at [The Bunto SEO Gem](https://github.com/pmarsceill/bunto-seo-gem).
|
24
|
+
|
25
|
+
Bunto 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.
|
26
|
+
|
27
|
+
## Documentation
|
28
|
+
|
29
|
+
For more information, see:
|
30
|
+
|
31
|
+
* [Installation](installation.md)
|
32
|
+
* [Usage](usage.md)
|
33
|
+
* [Advanced usage](advanced-usage.md)
|
data/docs/_config.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
6
|
+
<link href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}" rel="stylesheet">
|
7
|
+
{% seo %}
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div class="container markdown-body">
|
11
|
+
<h1>{{ site.title }}</h1>
|
12
|
+
|
13
|
+
{{ content }}
|
14
|
+
</div>
|
15
|
+
<script src="{{ "assets/javascript/anchor-js/anchor.min.js" | relative_url }}"></script>
|
16
|
+
<script>anchors.add();</script>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,138 @@
|
|
1
|
+
## Advanced usage
|
2
|
+
|
3
|
+
Bunto SEO Tag is designed to implement SEO best practices by default and to be the right fit for most sites right out of the box. If for some reason, you need more control over the output, read on:
|
4
|
+
|
5
|
+
### Disabling `<title>` output
|
6
|
+
|
7
|
+
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:
|
8
|
+
|
9
|
+
```
|
10
|
+
{% seo title=false %}
|
11
|
+
```
|
12
|
+
|
13
|
+
### Author information
|
14
|
+
|
15
|
+
Author information is used to propagate the `creator` field of Twitter summary cards. This should be an author-specific, not site-wide Twitter handle (the site-wide username be stored as `site.twitter.username`).
|
16
|
+
|
17
|
+
*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.*
|
18
|
+
|
19
|
+
There are several ways to convey this author-specific information. Author information is found in the following order of priority:
|
20
|
+
|
21
|
+
1. An `author` object, in the documents's front matter, e.g.:
|
22
|
+
|
23
|
+
```yml
|
24
|
+
author:
|
25
|
+
twitter: benbalter
|
26
|
+
```
|
27
|
+
|
28
|
+
2. An `author` object, in the site's `_config.yml`, e.g.:
|
29
|
+
|
30
|
+
```yml
|
31
|
+
author:
|
32
|
+
twitter: benbalter
|
33
|
+
```
|
34
|
+
|
35
|
+
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:
|
36
|
+
|
37
|
+
```yml
|
38
|
+
author: benbalter
|
39
|
+
```
|
40
|
+
|
41
|
+
And you have the following in `_data/authors.yml`:
|
42
|
+
|
43
|
+
```yml
|
44
|
+
benbalter:
|
45
|
+
picture: /img/benbalter.png
|
46
|
+
twitter: buntowaf
|
47
|
+
|
48
|
+
potus:
|
49
|
+
picture: /img/potus.png
|
50
|
+
twitter: whitehouse
|
51
|
+
```
|
52
|
+
|
53
|
+
In the above example, the author `benbalter`'s Twitter handle will be resolved to `@buntowaf`. 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.
|
54
|
+
|
55
|
+
*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.*
|
56
|
+
|
57
|
+
4. An author in the document's front matter (the simplest way), e.g.:
|
58
|
+
|
59
|
+
```yml
|
60
|
+
author: benbalter
|
61
|
+
```
|
62
|
+
|
63
|
+
5. An author in the site's `_config.yml`, e.g.:
|
64
|
+
|
65
|
+
```yml
|
66
|
+
author: benbalter
|
67
|
+
```
|
68
|
+
|
69
|
+
### Customizing JSON-LD output
|
70
|
+
|
71
|
+
The following options can be set for any particular page. While the default options are meant to serve most users in the most common circumstances, there may be situations where more precise control is necessary.
|
72
|
+
|
73
|
+
* `seo`
|
74
|
+
* `name` - If the name of the thing that the page represents is different from the page title. (i.e.: "Frank's Café" vs "Welcome to Frank's Café")
|
75
|
+
* `type` - The type of things that the page represents. This must be a [Schema.org type](http://schema.org/docs/schemas.html), and will probably usually be something like [`BlogPosting`](http://schema.org/BlogPosting), [`NewsArticle`](http://schema.org/NewsArticle), [`Person`](http://schema.org/Person), [`Organization`](http://schema.org/Organization), etc.
|
76
|
+
* `links` - An array of other URLs that represent the same thing that this page represents. For instance, Jane's bio page might include links to Jane's GitHub and Twitter profiles.
|
77
|
+
|
78
|
+
### Customizing image output
|
79
|
+
|
80
|
+
For most users, setting `image: [path-to-image]` on a per-page basis should be enough. If you need more control over how images are represented, the `image` property can also be an object, with the following options:
|
81
|
+
|
82
|
+
* `path` - The relative path to the image. Same as `image: [path-to-image]`
|
83
|
+
* `height` - The height of the Open Graph (`og:image`) image
|
84
|
+
* `width` - The width of the Open Graph (`og:image`) image
|
85
|
+
|
86
|
+
You can use any of the above, optional properties, like so:
|
87
|
+
|
88
|
+
```yml
|
89
|
+
image:
|
90
|
+
path: /img/twitter.png
|
91
|
+
height: 100
|
92
|
+
width: 100
|
93
|
+
```
|
94
|
+
|
95
|
+
### Setting a default image
|
96
|
+
|
97
|
+
You can define a default image using [Front Matter default](https://buntowaf.tk/docs/configuration/#front-matter-defaults), to provide a default Twitter Card or OGP image to all of your posts and pages.
|
98
|
+
|
99
|
+
Here is a very basic example, that you are encouraged to adapt to your needs:
|
100
|
+
|
101
|
+
```yml
|
102
|
+
defaults:
|
103
|
+
- scope:
|
104
|
+
path: ""
|
105
|
+
values:
|
106
|
+
image: /assets/images/default-card.png
|
107
|
+
```
|
108
|
+
|
109
|
+
### SmartyPants Titles
|
110
|
+
|
111
|
+
Titles will be processed using [Bunto's `smartify` filter](https://buntowaf.tk/docs/templates/). This will use SmartyPants to translate plain ASCII punctuation into "smart" typographic punctuation. This will not render or strip any Markdown you may be using in a page title.
|
112
|
+
|
113
|
+
### Setting customized Canonical URL
|
114
|
+
|
115
|
+
You can set custom Canonical URL for a page by specifying canonical_url option in page front-matter.
|
116
|
+
E.g., you have the following in the page's front matter:
|
117
|
+
```yml
|
118
|
+
layout: post
|
119
|
+
title: Title of Your Post
|
120
|
+
canonical_url: 'https://github.com/bunto/bunto-seo-tag/'
|
121
|
+
```
|
122
|
+
|
123
|
+
Which will generate canonical_url with specified link in canonical_url.
|
124
|
+
```html
|
125
|
+
<link rel="canonical" href="https://github.com/bunto/bunto-seo-tag/" />
|
126
|
+
```
|
127
|
+
|
128
|
+
If no canonical_url option was specified, then uses page url for generating canonical_url.
|
129
|
+
E.g., you have not specified canonical_url in front-matter:
|
130
|
+
```yml
|
131
|
+
layout: post
|
132
|
+
title: Title of Your Post
|
133
|
+
```
|
134
|
+
|
135
|
+
Which will generate following canonical_url:
|
136
|
+
```html
|
137
|
+
<link rel="canonical" href="http://yoursite.com/title-of-your-post" />
|
138
|
+
```
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Installing Bunto SEO Tag
|
2
|
+
|
3
|
+
1. Add the following to your site's `Gemfile`:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
gem 'bunto-seo-tag'
|
7
|
+
```
|
8
|
+
|
9
|
+
2. Add the following to your site's `_config.yml`:
|
10
|
+
|
11
|
+
```yml
|
12
|
+
gems:
|
13
|
+
- bunto-seo-tag
|
14
|
+
```
|
15
|
+
|
16
|
+
3. Add the following right before `</head>` in your site's template(s):
|
17
|
+
|
18
|
+
```liquid
|
19
|
+
{% seo %}
|
20
|
+
```
|