middleman-meta-tags 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -0
- data/lib/middleman-meta-tags/helpers.rb +7 -4
- data/lib/middleman-meta-tags/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6803be14195f73691870e518bed5ee152aa97279
|
4
|
+
data.tar.gz: 551c91e71ff4ae479096fc220855b4cdd6385bd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 269f88fc9a0693e4544d1e28ab8486256de73e24b5a26f7c77446e2678325d7e54045dc1670e86268a10b01f8914de9b7962a6277910402f930475f470fc6a3a
|
7
|
+
data.tar.gz: e2936137984b3dad0d7a7fb5cba75b8f4ddca44d9cd7611c2e5453a40d975ec6e3110c6e2af8ce5420ee31f3c4451438127f8db6720feb15eda11ff5207dd5bd
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -75,6 +75,7 @@ Then it looks the page meta data to attempt to display the following keys:
|
|
75
75
|
- MM `site` => META `title`
|
76
76
|
- MM `title` => META `title`
|
77
77
|
- MM `description` => META `description`
|
78
|
+
- MM `keywords` => META `keywords`
|
78
79
|
- MM `twitter_card` (defaults to `summary_large_image`) => META `twitter:card`
|
79
80
|
- MM `twitter_author` => META `twitter:creator`
|
80
81
|
- MM `description` => META `twitter:description`
|
@@ -2,7 +2,7 @@ module Middleman
|
|
2
2
|
module MetaTags
|
3
3
|
module Helpers
|
4
4
|
def meta_tags
|
5
|
-
@meta_tags ||=
|
5
|
+
@meta_tags ||= ActiveSupport::HashWithIndifferentAccess.new
|
6
6
|
end
|
7
7
|
|
8
8
|
def set_meta_tags(meta_tags = {})
|
@@ -23,9 +23,11 @@ module Middleman
|
|
23
23
|
|
24
24
|
def display_meta_tags(default = {})
|
25
25
|
result = []
|
26
|
-
meta_tags = default.merge(self.meta_tags)
|
26
|
+
meta_tags = default.merge(self.meta_tags).with_indifferent_access
|
27
27
|
|
28
28
|
title = full_title(meta_tags)
|
29
|
+
meta_tags.delete(:title)
|
30
|
+
meta_tags.delete(:separator)
|
29
31
|
result << content_tag(:title, title) unless title.blank?
|
30
32
|
|
31
33
|
description = safe_description(meta_tags.delete(:description))
|
@@ -49,13 +51,14 @@ module Middleman
|
|
49
51
|
end
|
50
52
|
|
51
53
|
def auto_tag
|
52
|
-
site_data = data['site'] || {}
|
54
|
+
site_data = (data['site'] || {}).with_indifferent_access
|
53
55
|
|
54
56
|
set_meta_tags site: site_data['site']
|
55
57
|
set_meta_tags 'og:site_name' => site_data['site']
|
56
58
|
|
57
59
|
fall_through(site_data, :title, 'title')
|
58
60
|
fall_through(site_data, :description, 'description')
|
61
|
+
fall_through(site_data, :keywords, 'keywords')
|
59
62
|
|
60
63
|
# Twitter cards
|
61
64
|
fall_through(site_data, 'twitter:card', 'twitter_card', 'summary_large_image')
|
@@ -74,7 +77,7 @@ module Middleman
|
|
74
77
|
private
|
75
78
|
|
76
79
|
def fall_through(site_data, name, key, default = nil)
|
77
|
-
value =
|
80
|
+
value = self.meta_tags[key] || site_data[key] || default
|
78
81
|
set_meta_tags name => value unless value.blank?
|
79
82
|
value
|
80
83
|
end
|