middleman-meta-tags 0.1.3 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 82257b5fe8995b6feda0362ca1f3fac4bb75a8ad
4
- data.tar.gz: 4e6b757305bb3d46d9a7020a5855889928424a0c
2
+ SHA256:
3
+ metadata.gz: ef14ab4f61e2d7198851cc0808879c8c3430a9bcdc2859da4ce1a0f1f013cdd4
4
+ data.tar.gz: e8f9404f1345214f339ca1c4c67c707fa5a2d8cdbae6e046b9d2ec3151c73685
5
5
  SHA512:
6
- metadata.gz: 05f1ea4d02707b13e5869d6084adc087bb752cb6b6462e35b2a76599fedd1329bd27e57d2e220765c6c952a5645713cf92a73a71cd1af9085dd95513aa3a2c7c
7
- data.tar.gz: 7726c4f903c1b6a3216587d100e14b72dbd721aeb9d47762d394cf1cf7c650ff5cde952184ad75c42edb1488022bf487b6dff4eb7d9345c6483c558e427704f3
6
+ metadata.gz: e288243971af0448eb3da675e580a1c5eb27621518c5d38f3823dca6780cfa2463cb508761d960ff4c6b1204df7e01d72b9eaf6691a5b392ea8cea9b3c7dc1bf
7
+ data.tar.gz: 3bfdfb8894575caf3f8530c096355d72e24e24e59d9da63f26e36e9deb2385ed191fa4104c8bcdbf7d4e9decf359b515c9cfc1ad7418aa9e2198d8827913f957
@@ -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
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea
@@ -0,0 +1 @@
1
+ middleman-meta-tags
@@ -0,0 +1 @@
1
+ ruby-2.6.2
@@ -1,4 +1,29 @@
1
- ## Next release
1
+ ## 0.6.0 (11/03/20)
2
+
3
+ * Allow viewport to be customized
4
+ * Add ability to not have images in meta data
5
+ * Use a newer version of Ruby
6
+
7
+ ## 0.5.0 (08/01/20)
8
+
9
+ * Description truncate to 220 chars
10
+ * Add test
11
+ * Add more tags
12
+
13
+ ## 0.4.0 (03/28/18)
14
+
15
+ * Added support for the meta HTTP refresh tag
16
+ * i18n compatibility for title and meta tags
17
+ * Description truncate to 300 chars
18
+
19
+ ## 0.3.0 (01/30/17)
20
+
21
+ * Keywords can be an Array
22
+ * Calculate pull_image path with image_path
23
+
24
+ ## 0.2.0 (03/30/16)
25
+
26
+ * Allow gem to work with middleman 4.0
2
27
 
3
28
  ## 0.1.3 (04/30/15)
4
29
 
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,9 @@ 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. Update `./lib/middleman-meta-tags/version.rb` and CHANGELOG.md
150
+ 2. `gem build middleman-meta-tags.gemspec`
151
+ 3. `bundle exec rake release`
@@ -2,5 +2,5 @@ require 'middleman-core'
2
2
 
3
3
  ::Middleman::Extensions.register(:meta_tags) do
4
4
  require 'middleman-meta-tags/extension'
5
- ::Middleman::MetaTags
5
+ ::Middleman::MetaTagsExtension
6
6
  end
@@ -1,11 +1,8 @@
1
+ require 'middleman-core'
1
2
  require 'middleman-meta-tags/helpers'
2
3
 
3
4
  module Middleman
4
- module MetaTags
5
- class << self
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,42 +5,89 @@ 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 description(description = nil)
13
- set_meta_tags(description: description) unless description.nil?
16
+ def set_link_tags(link_tags = {})
17
+ self.link_tags.merge! link_tags
14
18
  end
15
19
 
16
- def keywords(keywords = nil)
17
- set_meta_tags(keywords: keywords) unless keywords.nil?
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?
43
+
44
+ viewport = meta_tags.delete(:viewport)
45
+ result << tag(:meta, name: :viewport, content: viewport) if viewport.present?
27
46
 
28
- title = full_title(meta_tags)
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) unless title.blank?
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) unless description.blank?
59
+ result << tag(:meta, name: :description, content: description) if description.present?
35
60
 
36
61
  keywords = meta_tags.delete(:keywords)
37
- result << tag(:meta, name: :keywords, content: keywords) unless keywords.blank?
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
- if name.start_with?('og:')
41
- result << tag(:meta, property: name, content: content ) unless content.blank?
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
42
89
  else
43
- result << tag(:meta, name: name, content: content ) unless content.blank?
90
+ result << tag(:link, rel: rel, href: href) unless href.blank?
44
91
  end
45
92
  end
46
93
 
@@ -49,60 +96,150 @@ module Middleman
49
96
  end
50
97
 
51
98
  def auto_display_meta_tags(default = {})
52
- auto_tag
99
+ auto_set_meta_tags
53
100
 
54
101
  display_meta_tags default
55
102
  end
56
103
 
57
- def auto_tag
58
- site_data = (data['site'] || {}).with_indifferent_access
104
+ def auto_set_meta_tags
105
+ geocoding_data = site_data['geocoding'] || {}
106
+ author_data = site_data['author'] || {}
59
107
 
60
- set_meta_tags site: site_data['site']
61
- set_meta_tags 'og:site_name' => site_data['site']
108
+ set_meta_tags charset: 'utf-8',
109
+ 'http-equiv': 'IE=edge,chrome=1'
62
110
 
111
+ fall_through(site_data, :site, 'name')
112
+ fall_through(site_data, :site, 'site')
63
113
  fall_through(site_data, :title, 'title')
64
114
  fall_through(site_data, :description, 'description')
65
115
  fall_through(site_data, :keywords, 'keywords')
116
+ fall_through(site_data, :viewport, 'viewport', 'width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no')
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')
66
124
 
67
125
  # Twitter cards
68
- fall_through(site_data, 'twitter:card', 'twitter_card', 'summary_large_image')
69
- fall_through(site_data, 'twitter:creator', 'twitter_author')
70
- fall_through(site_data, 'twitter:description', 'description')
71
- fall_through(site_data, 'twitter:image:src', 'pull_image')
72
- fall_through(site_data, 'twitter:site', 'publisher_twitter')
73
- fall_through(site_data, 'twitter:title', 'title')
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')
74
138
 
75
139
  # Open Graph
76
- fall_through(site_data, 'og:description', 'description')
77
- fall_through(site_data, 'og:image', 'pull_image')
78
- fall_through(site_data, 'og:title', 'title')
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
79
176
  end
80
177
 
81
- private
178
+ private
82
179
 
83
180
  def fall_through(site_data, name, key, default = nil)
84
- value = self.meta_tags[key] || site_data[key] || default
85
- set_meta_tags name => value unless value.blank?
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?
86
192
  value
87
193
  end
88
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
+ return nil unless source.present?
207
+ File.join(meta_tags_host, image_path(source))
208
+ end
209
+
210
+ def meta_tags_host
211
+ (data['site'] || {})['host'] || ''
212
+ end
213
+
214
+ def uri?(path)
215
+ path =~ %r{^[-a-z]+://|^(?:cid|data):|^//}
216
+ end
217
+
89
218
  def full_title(meta_tags)
90
- separator = meta_tags[:separator] || '|'
219
+ separator = meta_tags[:separator] || '-'
91
220
  full_title = ''
92
221
  title = safe_title(meta_tags[:title])
93
222
 
94
- (full_title << title) unless title.blank?
223
+ (full_title << title) if title.present?
95
224
  (full_title << " #{separator} ") unless title.blank? || meta_tags[:site].blank?
96
- (full_title << meta_tags[:site]) unless meta_tags[:site].blank?
225
+ (full_title << meta_tags[:site]) if meta_tags[:site].present?
97
226
  full_title
98
227
  end
99
228
 
100
229
  def safe_description(description)
101
- truncate(strip_tags(description), length: 200)
230
+ description = description[I18n.locale] if description.is_a?(Hash) && description[I18n.locale]
231
+
232
+ description = I18n.t(description[2..-1]) if description&.start_with?('t:')
233
+
234
+ truncate(strip_tags(description), length: 220)
102
235
  end
103
236
 
104
237
  def safe_title(title)
105
- title = strip_tags(title)
238
+ title = title[I18n.locale] if title.is_a?(Hash) && title[I18n.locale]
239
+
240
+ title = I18n.t(title[2..-1]) if title&.start_with?('t:')
241
+
242
+ strip_tags(title)
106
243
  end
107
244
  end
108
245
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module MetaTags
3
- VERSION = '0.1.3'
3
+ VERSION = '0.6.0'
4
4
  end
5
5
  end
@@ -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', '~> 1.5'
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,89 @@
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
+
38
+ describe "auto_display_meta_tags" do
39
+ before do
40
+ allow(h).to receive(:data).and_return({})
41
+ end
42
+
43
+ it "includes a viewport tag" do
44
+ tags = h.auto_display_meta_tags.split("\n")
45
+ expect(tags).to include(
46
+ '<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />'
47
+ )
48
+ end
49
+
50
+ it "prefers viewport from site data" do
51
+ allow(h).to receive(:data).and_return(
52
+ {
53
+ "site" => {
54
+ "viewport" => "width=device-width,user-scalable=yes"
55
+ }
56
+ }
57
+ )
58
+
59
+ tags = h.auto_display_meta_tags.split("\n")
60
+ expect(tags).to include(
61
+ '<meta name="viewport" content="width=device-width,user-scalable=yes" />'
62
+ )
63
+ end
64
+ end
65
+
66
+ describe "meta_tags_image_url" do
67
+ before do
68
+ allow(h).to receive(:data).and_return(
69
+ {
70
+ "site" => {
71
+ "host" => "https://example.com"
72
+ }
73
+ }
74
+ )
75
+ end
76
+
77
+ it "returns a URL when image is given" do
78
+ expect(
79
+ h.send(:meta_tags_image_url, "/awesome/image.jpg")
80
+ ).to eq("https://example.com/awesome/image.jpg")
81
+ end
82
+
83
+ it "returns nil when image is nil" do
84
+ expect(
85
+ h.send(:meta_tags_image_url, nil)
86
+ ).to be_nil
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,6 @@
1
+ require 'active_support/all'
2
+ require 'middleman-core'
3
+ require 'middleman-meta-tags/extension'
4
+ require 'padrino-helpers'
5
+
6
+ include Padrino::Helpers
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.1.3
4
+ version: 0.6.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: 2015-04-30 00:00:00.000000000 Z
11
+ date: 2020-11-03 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: '1.5'
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: '1.5'
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.txt
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
- rubyforge_project:
94
- rubygems_version: 2.4.1
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
@@ -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.