middleman-meta-tags 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +3 -2
- data/lib/middleman-meta-tags/helpers.rb +2 -1
- data/lib/middleman-meta-tags/version.rb +1 -1
- data/spec/middleman-meta-tags/helpers_spec.rb +52 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef14ab4f61e2d7198851cc0808879c8c3430a9bcdc2859da4ce1a0f1f013cdd4
|
4
|
+
data.tar.gz: e8f9404f1345214f339ca1c4c67c707fa5a2d8cdbae6e046b9d2ec3151c73685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e288243971af0448eb3da675e580a1c5eb27621518c5d38f3823dca6780cfa2463cb508761d960ff4c6b1204df7e01d72b9eaf6691a5b392ea8cea9b3c7dc1bf
|
7
|
+
data.tar.gz: 3bfdfb8894575caf3f8530c096355d72e24e24e59d9da63f26e36e9deb2385ed191fa4104c8bcdbf7d4e9decf359b515c9cfc1ad7418aa9e2198d8827913f957
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2
|
1
|
+
ruby-2.6.2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -146,5 +146,6 @@ pull_image 'page/to/image/jpg'
|
|
146
146
|
|
147
147
|
## Publishing
|
148
148
|
|
149
|
-
1.
|
150
|
-
2. `
|
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`
|
@@ -106,7 +106,6 @@ module Middleman
|
|
106
106
|
author_data = site_data['author'] || {}
|
107
107
|
|
108
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
109
|
'http-equiv': 'IE=edge,chrome=1'
|
111
110
|
|
112
111
|
fall_through(site_data, :site, 'name')
|
@@ -114,6 +113,7 @@ module Middleman
|
|
114
113
|
fall_through(site_data, :title, 'title')
|
115
114
|
fall_through(site_data, :description, 'description')
|
116
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
117
|
|
118
118
|
# Microdata
|
119
119
|
fall_through(site_data, 'itemprop:name', 'name')
|
@@ -203,6 +203,7 @@ module Middleman
|
|
203
203
|
end
|
204
204
|
|
205
205
|
def meta_tags_image_url(source)
|
206
|
+
return nil unless source.present?
|
206
207
|
File.join(meta_tags_host, image_path(source))
|
207
208
|
end
|
208
209
|
|
@@ -34,4 +34,56 @@ describe Middleman::MetaTags::Helpers do
|
|
34
34
|
expect(h.display_meta_tags site: 'My Awesome Website').to eql('<title>My Awesome Website</title>
|
35
35
|
<link rel="site" href="My Awesome Website" />')
|
36
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
|
37
89
|
end
|
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.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Baptiste Lecocq
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|