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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02c4fc53127527072b750dfd8ea5d13f12f83aaf
4
- data.tar.gz: 4e2ec0e3cf1432a0e6d40ba84002366be81a9c22
3
+ metadata.gz: 6803be14195f73691870e518bed5ee152aa97279
4
+ data.tar.gz: 551c91e71ff4ae479096fc220855b4cdd6385bd7
5
5
  SHA512:
6
- metadata.gz: ee0b14cf4b004632fcb1f73639c88d16c80ba807a187a54c1938a83e88de77a0ba35d2d91ad1e83cf8520ec24bed0eb86684bb9ea13b6ed629c01f4068d30bc3
7
- data.tar.gz: a3b39a7e54eb727b8a9ae1d0fa9cea26bf4c8ffe6a0efb726e5e8d333b7df0b8f989f092e5a36cc6da7126e4be195b4edb95735cf7b14d1fee4dfdd64c85830b
6
+ metadata.gz: 269f88fc9a0693e4544d1e28ab8486256de73e24b5a26f7c77446e2678325d7e54045dc1670e86268a10b01f8914de9b7962a6277910402f930475f470fc6a3a
7
+ data.tar.gz: e2936137984b3dad0d7a7fb5cba75b8f4ddca44d9cd7611c2e5453a40d975ec6e3110c6e2af8ce5420ee31f3c4451438127f8db6720feb15eda11ff5207dd5bd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Next release
2
2
 
3
+ ## 0.1.2 (01/09/15)
4
+
5
+ * Add keywords into site data
6
+ * Fix bug with HashWithIndifferentAccess
7
+
3
8
  ## 0.1.1 (01/09/15)
4
9
 
5
10
  * Fix `site` key which was unavailable
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 = current_page.data[key] || site_data[key] || default
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
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module MetaTags
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-meta-tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Baptiste Lecocq