middleman-meta-tags 0.1.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +23 -0
- data/.gitignore +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +24 -1
- data/LICENSE +21 -0
- data/README.md +40 -0
- data/lib/middleman-meta-tags.rb +1 -1
- data/lib/middleman-meta-tags/extension.rb +3 -6
- data/lib/middleman-meta-tags/helpers.rb +171 -31
- data/lib/middleman-meta-tags/version.rb +1 -1
- data/middleman-meta-tags.gemspec +2 -1
- data/spec/middleman-meta-tags/helpers_spec.rb +37 -0
- data/spec/spec_helper.rb +6 -0
- metadata +33 -13
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 59169e69789518c47ce31641beab6af4880726df72a26ab5941b254a7b5dca37
|
4
|
+
data.tar.gz: 74d48cfd537a22182d15698f131e56a9b12f796ac6d3d7f3fe9f9154b60c0980
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20ffc6fcaa9b666ab2c85afd5f2ce0d30dc95bc32fae5fc3ccfe957239d239fc8ee9f91d160931aac9d4fef1937f8200d877eaa5e616f3cebeab75fff23d37c1
|
7
|
+
data.tar.gz: 6695dd19fd1cc06da7da79831d90147d64441e30c54b534d1e04898f20bf538d087f15c5c6f884f66433d549bde7d89c06b47279fc68e5675413871764bb7207
|
@@ -0,0 +1,23 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 2.6
|
20
|
+
- name: Install dependencies
|
21
|
+
run: bundle install
|
22
|
+
- name: Run tests
|
23
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
middleman-meta-tags
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,27 @@
|
|
1
|
-
##
|
1
|
+
## 0.5.0 (08/01/20)
|
2
|
+
|
3
|
+
* Description truncate to 220 chars
|
4
|
+
* Add test
|
5
|
+
* Add more tags
|
6
|
+
|
7
|
+
## 0.4.0 (03/28/18)
|
8
|
+
|
9
|
+
* Added support for the meta HTTP refresh tag
|
10
|
+
* i18n compatibility for title and meta tags
|
11
|
+
* Description truncate to 300 chars
|
12
|
+
|
13
|
+
## 0.3.0 (01/30/17)
|
14
|
+
|
15
|
+
* Keywords can be an Array
|
16
|
+
* Calculate pull_image path with image_path
|
17
|
+
|
18
|
+
## 0.2.0 (03/30/16)
|
19
|
+
|
20
|
+
* Allow gem to work with middleman 4.0
|
21
|
+
|
22
|
+
## 0.1.3 (04/30/15)
|
23
|
+
|
24
|
+
* Fix `og:` tag syntax
|
2
25
|
|
3
26
|
## 0.1.2 (01/09/15)
|
4
27
|
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Baptiste Lecocq
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -49,6 +49,14 @@ set_meta_tags keywords: %w(some seo keywords).join(', ')
|
|
49
49
|
keywords %w(some seo keywords).join(', ')
|
50
50
|
```
|
51
51
|
|
52
|
+
### Meta-Refresh
|
53
|
+
|
54
|
+
To set the HTTP Meta-Refresh property of a page, use the `refresh` key:
|
55
|
+
|
56
|
+
```rb
|
57
|
+
set_meta_tags refresh: "0;url=http://example.com/"
|
58
|
+
```
|
59
|
+
|
52
60
|
## Display meta tags
|
53
61
|
|
54
62
|
Into your `<head></head>` tag:
|
@@ -86,6 +94,11 @@ Then it looks the page meta data to attempt to display the following keys:
|
|
86
94
|
- MM `pull_image` => META `og:image`
|
87
95
|
- MM `site` => META `og:site_name`
|
88
96
|
- MM `title` => META `og:title`
|
97
|
+
- MM `host` => optional attribute for composing `pull_image` src with asset helper
|
98
|
+
|
99
|
+
In addition, if you want to customize meta tags by each page's frontmatter, you
|
100
|
+
can add `customize_by_frontmatter: true` in `data/site.yml`. The priority would
|
101
|
+
be set_meta_tags > frontmatter > site wide defaults.
|
89
102
|
|
90
103
|
### Manually adding addition tags
|
91
104
|
|
@@ -101,6 +114,28 @@ end
|
|
101
114
|
|
102
115
|
And add it to the layouts and views that you need.
|
103
116
|
|
117
|
+
### Pull images
|
118
|
+
|
119
|
+
For the `pull_image` to render for twitter metatags, a full url must be used:
|
120
|
+
|
121
|
+
```
|
122
|
+
pull_image: 'http://example.com/path/to/image.jpg'
|
123
|
+
```
|
124
|
+
|
125
|
+
If pointing to an image in your Middleman source, you can instead specify the
|
126
|
+
relative image path as you would with an asset helper provided you have also
|
127
|
+
configured the `host` in your `site.yml`. If your Middleman build activates
|
128
|
+
extensions like `:asset_hash`, the full, hashed URL will be generated in your
|
129
|
+
metatags.
|
130
|
+
|
131
|
+
```
|
132
|
+
# site.yml
|
133
|
+
host: http://example.com
|
134
|
+
|
135
|
+
# your article
|
136
|
+
pull_image 'page/to/image/jpg'
|
137
|
+
```
|
138
|
+
|
104
139
|
## Contributing
|
105
140
|
|
106
141
|
1. [Fork it](http://github.com/tiste/middleman-meta-tags/fork)
|
@@ -108,3 +143,8 @@ And add it to the layouts and views that you need.
|
|
108
143
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
109
144
|
4. Push to the branch (`git push origin my-new-feature`)
|
110
145
|
5. Create new Pull Request
|
146
|
+
|
147
|
+
## Publishing
|
148
|
+
|
149
|
+
1. `gem build middleman-meta-tags.gemspec`
|
150
|
+
2. `bundle exec rake release`
|
data/lib/middleman-meta-tags.rb
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
+
require 'middleman-core'
|
1
2
|
require 'middleman-meta-tags/helpers'
|
2
3
|
|
3
4
|
module Middleman
|
4
|
-
|
5
|
-
|
6
|
-
def registered(app, options_hash = {}, &block)
|
7
|
-
app.helpers Middleman::MetaTags::Helpers
|
8
|
-
end
|
9
|
-
end
|
5
|
+
class MetaTagsExtension < Extension
|
6
|
+
self.defined_helpers = [Middleman::MetaTags::Helpers]
|
10
7
|
end
|
11
8
|
end
|
@@ -5,39 +5,90 @@ module Middleman
|
|
5
5
|
@meta_tags ||= ActiveSupport::HashWithIndifferentAccess.new
|
6
6
|
end
|
7
7
|
|
8
|
+
def link_tags
|
9
|
+
@link_tags ||= ActiveSupport::HashWithIndifferentAccess.new
|
10
|
+
end
|
11
|
+
|
8
12
|
def set_meta_tags(meta_tags = {})
|
9
13
|
self.meta_tags.merge! meta_tags
|
10
14
|
end
|
11
15
|
|
12
|
-
def
|
13
|
-
|
16
|
+
def set_link_tags(link_tags = {})
|
17
|
+
self.link_tags.merge! link_tags
|
14
18
|
end
|
15
19
|
|
16
|
-
def
|
17
|
-
|
20
|
+
def site_data
|
21
|
+
(data['site'] || {}).with_indifferent_access
|
18
22
|
end
|
19
23
|
|
20
24
|
def title(title = nil)
|
21
25
|
set_meta_tags(title: title) unless title.nil?
|
22
26
|
end
|
23
27
|
|
28
|
+
def description(description = nil)
|
29
|
+
set_meta_tags(description: description) unless description.nil?
|
30
|
+
end
|
31
|
+
|
32
|
+
def keywords(keywords = nil)
|
33
|
+
set_meta_tags(keywords: keywords) unless keywords.nil?
|
34
|
+
end
|
35
|
+
|
24
36
|
def display_meta_tags(default = {})
|
25
37
|
result = []
|
26
38
|
meta_tags = default.merge(self.meta_tags).with_indifferent_access
|
39
|
+
link_tags = default.merge(self.link_tags)
|
40
|
+
|
41
|
+
charset = meta_tags.delete(:charset)
|
42
|
+
result << tag(:meta, charset: charset) if charset.present?
|
27
43
|
|
28
|
-
|
44
|
+
viewport = meta_tags.delete(:viewport)
|
45
|
+
result << tag(:meta, name: :viewport, content: viewport) if viewport.present?
|
46
|
+
|
47
|
+
http_equiv = meta_tags.delete('http-equiv')
|
48
|
+
result << tag(:meta, 'http-equiv': 'X-UA-Compatible', content: http_equiv) if http_equiv.present?
|
49
|
+
|
50
|
+
need_full_title = true
|
51
|
+
need_full_title = meta_tags['full_title'] unless meta_tags['full_title'].nil?
|
52
|
+
need_full_title = current_page.data['full_title'] unless current_page.data['full_title'].nil?
|
53
|
+
title = need_full_title ? full_title(meta_tags) : safe_title(meta_tags[:title])
|
29
54
|
meta_tags.delete(:title)
|
30
55
|
meta_tags.delete(:separator)
|
31
|
-
result << content_tag(:title, title)
|
56
|
+
result << content_tag(:title, title) if title.present?
|
32
57
|
|
33
58
|
description = safe_description(meta_tags.delete(:description))
|
34
|
-
result << tag(:meta, name: :description, content: description)
|
59
|
+
result << tag(:meta, name: :description, content: description) if description.present?
|
35
60
|
|
36
61
|
keywords = meta_tags.delete(:keywords)
|
37
|
-
|
62
|
+
keywords = keywords.join(', ') if keywords.is_a?(Array)
|
63
|
+
result << tag(:meta, name: :keywords, content: keywords) if keywords.present?
|
64
|
+
|
65
|
+
refresh = meta_tags.delete(:refresh)
|
66
|
+
result << tag(:meta, {content: refresh, 'http-equiv': 'refresh'}) if refresh.present?
|
38
67
|
|
39
68
|
meta_tags.each do |name, content|
|
40
|
-
|
69
|
+
unless content.blank? || %(site latitude longitude).include?(name)
|
70
|
+
if name.start_with?('itemprop:')
|
71
|
+
result << tag(:meta, itemprop: name.gsub('itemprop:', ''), content: content)
|
72
|
+
elsif name.start_with?('og:')
|
73
|
+
result << tag(:meta, property: name, content: content)
|
74
|
+
else
|
75
|
+
result << tag(:meta, name: name, content: content)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
position = [meta_tags.delete(:latitude), meta_tags.delete(:longitude)] if meta_tags['latitude'] && meta_tags['longitude']
|
81
|
+
result << tag(:meta, name: 'geo:position', content: position.join(';')) if position
|
82
|
+
result << tag(:meta, name: 'ICBM', content: position.join(', ')) if position
|
83
|
+
|
84
|
+
link_tags.each do |rel, href|
|
85
|
+
if href.kind_of?(Array)
|
86
|
+
href.each do |link|
|
87
|
+
result << tag(:link, rel: rel, href: link)
|
88
|
+
end
|
89
|
+
else
|
90
|
+
result << tag(:link, rel: rel, href: href) unless href.blank?
|
91
|
+
end
|
41
92
|
end
|
42
93
|
|
43
94
|
result = result.join("\n")
|
@@ -45,60 +96,149 @@ module Middleman
|
|
45
96
|
end
|
46
97
|
|
47
98
|
def auto_display_meta_tags(default = {})
|
48
|
-
|
99
|
+
auto_set_meta_tags
|
49
100
|
|
50
101
|
display_meta_tags default
|
51
102
|
end
|
52
103
|
|
53
|
-
def
|
54
|
-
|
104
|
+
def auto_set_meta_tags
|
105
|
+
geocoding_data = site_data['geocoding'] || {}
|
106
|
+
author_data = site_data['author'] || {}
|
55
107
|
|
56
|
-
set_meta_tags
|
57
|
-
|
108
|
+
set_meta_tags charset: 'utf-8',
|
109
|
+
viewport: 'width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no',
|
110
|
+
'http-equiv': 'IE=edge,chrome=1'
|
58
111
|
|
112
|
+
fall_through(site_data, :site, 'name')
|
113
|
+
fall_through(site_data, :site, 'site')
|
59
114
|
fall_through(site_data, :title, 'title')
|
60
115
|
fall_through(site_data, :description, 'description')
|
61
116
|
fall_through(site_data, :keywords, 'keywords')
|
62
117
|
|
118
|
+
# Microdata
|
119
|
+
fall_through(site_data, 'itemprop:name', 'name')
|
120
|
+
fall_through(site_data, 'itemprop:name', 'site')
|
121
|
+
fall_through(site_data, 'itemprop:name', 'title')
|
122
|
+
fall_through(site_data, 'itemprop:description', 'description')
|
123
|
+
fall_through_image(site_data, 'itemprop:image', 'thumbnail')
|
124
|
+
|
63
125
|
# Twitter cards
|
64
|
-
|
65
|
-
fall_through(site_data,
|
66
|
-
fall_through(site_data,
|
67
|
-
fall_through(site_data,
|
68
|
-
fall_through(
|
69
|
-
|
126
|
+
set_meta_tags 'twitter:card': 'summary_large_image'
|
127
|
+
fall_through(site_data, 'twitter:card', 'twitter_card')
|
128
|
+
fall_through(site_data, 'twitter:site', 'name')
|
129
|
+
fall_through(site_data, 'twitter:site', 'site')
|
130
|
+
fall_through(author_data, 'twitter:creator', 'twitter')
|
131
|
+
set_meta_tags 'twitter:url': current_page_url
|
132
|
+
fall_through(site_data, 'twitter:url', 'url')
|
133
|
+
fall_through(site_data, 'twitter:title', 'name')
|
134
|
+
fall_through(site_data, 'twitter:title', 'site')
|
135
|
+
fall_through(site_data, 'twitter:title', 'title')
|
136
|
+
fall_through(site_data, 'twitter:description', 'description')
|
137
|
+
fall_through_image(site_data, 'twitter:image', 'thumbnail')
|
70
138
|
|
71
139
|
# Open Graph
|
72
|
-
|
73
|
-
fall_through(site_data,
|
74
|
-
|
140
|
+
set_meta_tags 'og:url': current_page_url
|
141
|
+
fall_through(site_data, 'og:url', 'url')
|
142
|
+
set_meta_tags 'og:type': 'website'
|
143
|
+
fall_through(site_data, 'og:type', 'type')
|
144
|
+
fall_through(site_data, 'og:title', 'name')
|
145
|
+
fall_through(site_data, 'og:title', 'site')
|
146
|
+
fall_through(site_data, 'og:title', 'title')
|
147
|
+
fall_through_image(site_data, 'og:image', 'thumbnail')
|
148
|
+
fall_through(site_data, 'og:description', 'description')
|
149
|
+
fall_through(site_data, 'og:site_name', 'name')
|
150
|
+
fall_through(site_data, 'og:site_name', 'site')
|
151
|
+
set_meta_tags 'og:locale': 'en_US'
|
152
|
+
fall_through(site_data, 'og:locale', 'locale')
|
153
|
+
|
154
|
+
# Theme color
|
155
|
+
fall_through(site_data, 'theme-color', 'base_color')
|
156
|
+
fall_through(site_data, 'msapplication-TileColor', 'base_color')
|
157
|
+
|
158
|
+
# Geocoding
|
159
|
+
fall_through(geocoding_data, 'latitude', 'latitude')
|
160
|
+
fall_through(geocoding_data, 'longitude', 'longitude')
|
161
|
+
fall_through(geocoding_data, 'geo.placename', 'place')
|
162
|
+
fall_through(geocoding_data, 'geo.region', 'region')
|
163
|
+
|
164
|
+
# Author
|
165
|
+
set_link_tags author: author_data['website'] if author_data['website']
|
166
|
+
set_link_tags license: site_data['license'] if site_data['license']
|
167
|
+
|
168
|
+
me_link_tags = []
|
169
|
+
me_link_tags << author_data['website'] if author_data['website']
|
170
|
+
me_link_tags << "mailto:#{author_data['email']}" if author_data['email'].present?
|
171
|
+
me_link_tags += ["tel:#{author_data['phone']}", "sms:#{author_data['phone']}"] if author_data['phone'].present?
|
172
|
+
%w(github twitter dribbble medium linkedin facebook instagram gitlab bitbucket).each do |social|
|
173
|
+
me_link_tags << "https://#{social}#{['bitbucket'].include?(social) ? '.org' : '.com'}/#{'in/' if social == 'linkedin'}#{author_data[social]}" if author_data[social].present?
|
174
|
+
set_link_tags me: me_link_tags
|
175
|
+
end
|
75
176
|
end
|
76
177
|
|
77
|
-
|
178
|
+
private
|
78
179
|
|
79
180
|
def fall_through(site_data, name, key, default = nil)
|
80
|
-
value =
|
81
|
-
|
181
|
+
value = current_page.data[key] ||
|
182
|
+
meta_tags[key] ||
|
183
|
+
site_data[key] ||
|
184
|
+
default
|
185
|
+
|
186
|
+
value = yield value if block_given?
|
187
|
+
|
188
|
+
value = safe_title(value) if key == 'title'
|
189
|
+
value = safe_description(value) if key == 'description'
|
190
|
+
|
191
|
+
set_meta_tags name => value if value.present?
|
82
192
|
value
|
83
193
|
end
|
84
194
|
|
195
|
+
def fall_through_image(*args)
|
196
|
+
fall_through(*args) do |path|
|
197
|
+
uri?(path) && path ? path : meta_tags_image_url(path)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
def current_page_url
|
202
|
+
meta_tags_host + current_page.url unless (data['site'] || {})['host'].nil?
|
203
|
+
end
|
204
|
+
|
205
|
+
def meta_tags_image_url(source)
|
206
|
+
File.join(meta_tags_host, image_path(source))
|
207
|
+
end
|
208
|
+
|
209
|
+
def meta_tags_host
|
210
|
+
(data['site'] || {})['host'] || ''
|
211
|
+
end
|
212
|
+
|
213
|
+
def uri?(path)
|
214
|
+
path =~ %r{^[-a-z]+://|^(?:cid|data):|^//}
|
215
|
+
end
|
216
|
+
|
85
217
|
def full_title(meta_tags)
|
86
|
-
separator = meta_tags[:separator] || '
|
218
|
+
separator = meta_tags[:separator] || '-'
|
87
219
|
full_title = ''
|
88
220
|
title = safe_title(meta_tags[:title])
|
89
221
|
|
90
|
-
(full_title << title)
|
222
|
+
(full_title << title) if title.present?
|
91
223
|
(full_title << " #{separator} ") unless title.blank? || meta_tags[:site].blank?
|
92
|
-
(full_title << meta_tags[:site])
|
224
|
+
(full_title << meta_tags[:site]) if meta_tags[:site].present?
|
93
225
|
full_title
|
94
226
|
end
|
95
227
|
|
96
228
|
def safe_description(description)
|
97
|
-
|
229
|
+
description = description[I18n.locale] if description.is_a?(Hash) && description[I18n.locale]
|
230
|
+
|
231
|
+
description = I18n.t(description[2..-1]) if description&.start_with?('t:')
|
232
|
+
|
233
|
+
truncate(strip_tags(description), length: 220)
|
98
234
|
end
|
99
235
|
|
100
236
|
def safe_title(title)
|
101
|
-
title =
|
237
|
+
title = title[I18n.locale] if title.is_a?(Hash) && title[I18n.locale]
|
238
|
+
|
239
|
+
title = I18n.t(title[2..-1]) if title&.start_with?('t:')
|
240
|
+
|
241
|
+
strip_tags(title)
|
102
242
|
end
|
103
243
|
end
|
104
244
|
end
|
data/middleman-meta-tags.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'middleman-core', ['>= 3.0.0']
|
22
22
|
|
23
|
-
spec.add_development_dependency 'bundler'
|
23
|
+
spec.add_development_dependency 'bundler'
|
24
24
|
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
25
26
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Middleman::MetaTags::Helpers do
|
4
|
+
let(:h) { Class.new { extend Middleman::MetaTags::Helpers } }
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
allow(h).to receive_message_chain(:current_page, :data).and_return({ full_title: nil })
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'transforms title tag' do
|
11
|
+
h.set_meta_tags title: 'Relevant title'
|
12
|
+
expect(h.display_meta_tags).to eql('<title>Relevant title</title>')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'transforms description tag' do
|
16
|
+
h.set_meta_tags description: 'Relevant title of more than 220 characters
|
17
|
+
1 Relevant title of more than 220 characters
|
18
|
+
2 Relevant title of more than 220 characters
|
19
|
+
3 Relevant title of more than 220 characters
|
20
|
+
4 Relevant title of more than 220 characters'
|
21
|
+
expect(h.display_meta_tags).to eql('<meta name="description" content="Relevant title of more than 220 characters
|
22
|
+
1 Relevant title of more than 220 characters
|
23
|
+
2 Relevant title of more than 220 characters
|
24
|
+
3 Relevant title of more than 220 characters
|
25
|
+
4 Relevant title of more than 220 chara..." />')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'transforms keywords tag' do
|
29
|
+
h.set_meta_tags keywords: %w(some seo keywords)
|
30
|
+
expect(h.display_meta_tags).to eql('<meta name="keywords" content="some, seo, keywords" />')
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'transforms site tag' do
|
34
|
+
expect(h.display_meta_tags site: 'My Awesome Website').to eql('<title>My Awesome Website</title>
|
35
|
+
<link rel="site" href="My Awesome Website" />')
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-meta-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Baptiste Lecocq
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.2'
|
55
69
|
description: Easy integration of meta tags into your Middleman applications
|
56
70
|
email:
|
57
71
|
- hello@tiste.io
|
@@ -59,10 +73,13 @@ executables: []
|
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
76
|
+
- ".github/workflows/ruby.yml"
|
62
77
|
- ".gitignore"
|
78
|
+
- ".ruby-gemset"
|
79
|
+
- ".ruby-version"
|
63
80
|
- CHANGELOG.md
|
64
81
|
- Gemfile
|
65
|
-
- LICENSE
|
82
|
+
- LICENSE
|
66
83
|
- README.md
|
67
84
|
- Rakefile
|
68
85
|
- lib/middleman-meta-tags.rb
|
@@ -71,11 +88,13 @@ files:
|
|
71
88
|
- lib/middleman-meta-tags/version.rb
|
72
89
|
- lib/middleman_extension.rb
|
73
90
|
- middleman-meta-tags.gemspec
|
91
|
+
- spec/middleman-meta-tags/helpers_spec.rb
|
92
|
+
- spec/spec_helper.rb
|
74
93
|
homepage: https://github.com/tiste/middleman-meta-tags
|
75
94
|
licenses:
|
76
95
|
- MIT
|
77
96
|
metadata: {}
|
78
|
-
post_install_message:
|
97
|
+
post_install_message:
|
79
98
|
rdoc_options: []
|
80
99
|
require_paths:
|
81
100
|
- lib
|
@@ -90,9 +109,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
109
|
- !ruby/object:Gem::Version
|
91
110
|
version: '0'
|
92
111
|
requirements: []
|
93
|
-
|
94
|
-
|
95
|
-
signing_key:
|
112
|
+
rubygems_version: 3.0.8
|
113
|
+
signing_key:
|
96
114
|
specification_version: 4
|
97
115
|
summary: Meta tags for Middleman
|
98
|
-
test_files:
|
116
|
+
test_files:
|
117
|
+
- spec/middleman-meta-tags/helpers_spec.rb
|
118
|
+
- spec/spec_helper.rb
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Baptiste Lecocq
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|