middleman-meta-tags 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YWQ0Mzc0NGExYmJkODcwNWE1ZWY2MGY3MmFlOTNiYTlkMTFlMDU5Yw==
5
- data.tar.gz: !binary |-
6
- MjY1ZTIwZDJjMzY1NjA1OTA2MWI0ZGVkNjJkZWZkZTEzMWZmZmRjNw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MzdlOTI1NzZhNjE1OWI1MzgzMGM1MzJmOTM2MDI1M2FmNjIxZmJlODMzMGYy
10
- YmNiMTVlMWQ5YjAyMjhiYzY5MTVkZjJjMDMyZmI0YTc1NDIzZmExZTczMDRk
11
- NTY2OGEzNjIyYzA2OTZiZmI1YWZiYjdjYTFlNGMwYTE3Yzg0MGM=
12
- data.tar.gz: !binary |-
13
- MDA1NGUzNzQ5YWZjN2NjNjJhNDRiYTZmMDk1YzVkM2Q4YTQ3ZTQ5OTc1Mzc0
14
- YmVmZDA5YTI3MDA4NzU4ZWE3NThkMDkxMzc2ZmFlYWFiMGZiNmM2ODYzNjE0
15
- M2NhM2YxMzAwYzIxZjBkNGVlMTkxZDlmYmVlOGI3ZmNkYWExYjk=
2
+ SHA1:
3
+ metadata.gz: 1ba5d77a153f07db5c3cc2b71e92892bf08685da
4
+ data.tar.gz: f6af45ab5fc6926f56e0c6bcce01743feabe32c9
5
+ SHA512:
6
+ metadata.gz: 5a2891c2190cb3873bb35372d1759739030f1b3a06ab5edaac8e3ded4ee6a9f5e8649ccb2141b1ed9a6eb2d69121276495ae6d6f1283dc03de193b40ce694798
7
+ data.tar.gz: d431b43e52f9482f50918a863dba273f83cf98f5019a2bd9197c5c02b971a48fbc7baf0ce6c27f6570cbe7d5cf0cbcde67c4156c4745bd4c984c5345f091f280
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Next release
2
2
 
3
+ ## 0.1.0 (12/24/14)
4
+
5
+ * Update README
6
+ * Add autotagging
7
+ * Add Open Graph and Twitter cards meta tags
8
+
3
9
  ## 0.0.1 (03/23/14)
4
10
 
5
11
  * Add title, description and keywords helpers
data/README.md CHANGED
@@ -20,11 +20,19 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
+ ### Configuration
24
+
25
+ Edit `config.rb` and add:
26
+
27
+ ```rb
28
+ activate :meta_tags
29
+ ```
30
+
23
31
  ### Title
24
32
 
25
33
  ```rb
26
- set_meta_tags title: 'My Awesome Website'
27
- title 'My Awesome Website'
34
+ set_meta_tags title: 'Relevant title'
35
+ title 'Relevant title'
28
36
  ```
29
37
 
30
38
  ### Description
@@ -53,6 +61,44 @@ By default, there is a `|` as separator between title and website name.
53
61
 
54
62
  You can modify it by adding: `separator: '»'`
55
63
 
64
+ ## Autotagging
65
+
66
+ If you want to enable auto meta tagging, put this in you `<head></head>` tag:
67
+
68
+ ```rb
69
+ auto_display_meta_tags
70
+ ```
71
+
72
+ This will look inside of `data/site.yml` file to find any site wide defaults.
73
+ Then it looks the page meta data to attempt to display the following keys:
74
+
75
+ - MM `title` => META `title`
76
+ - MM `description` => META `description`
77
+ - MM `twitter_card` (defaults to `summary_large_image`) => META `twitter:card`
78
+ - MM `twitter_author` => META `twitter:creator`
79
+ - MM `description` => META `twitter:description`
80
+ - MM `pull_image` => META `twitter:image:src`
81
+ - MM `publisher_twitter` => META `twitter:site`
82
+ - MM `title` => META `twitter:title`
83
+ - MM `description` => META `og:description`
84
+ - MM `pull_image` => META `og:image`
85
+ - MM `title` => META `og:site_name`
86
+ - MM `title` => META `og:title`
87
+
88
+ ### Manually adding addition tags
89
+
90
+ Create a helper method inside of your config.rb, like so
91
+
92
+ ```rb
93
+ helper do
94
+ def my_tags
95
+ set_meta_tags key => value
96
+ end
97
+ end
98
+ ```
99
+
100
+ And add it to the layouts and views that you need.
101
+
56
102
  ## Contributing
57
103
 
58
104
  1. [Fork it](http://github.com/tiste/middleman-meta-tags/fork)
@@ -34,12 +34,51 @@ module Middleman
34
34
  keywords = meta_tags.delete(:keywords)
35
35
  result << tag(:meta, name: :keywords, content: keywords) unless keywords.blank?
36
36
 
37
+ meta_tags.each do |name, content|
38
+ result << tag(:meta, name: name, content: content ) unless content.blank?
39
+ end
40
+
37
41
  result = result.join("\n")
38
42
  result.html_safe
39
43
  end
40
44
 
45
+ def auto_display_meta_tags(default = {})
46
+ auto_tag
47
+
48
+ display_meta_tags default
49
+ end
50
+
51
+ def auto_tag
52
+ site_data = data['site'] || {}
53
+
54
+ set_meta_tags site: site_data['title']
55
+ set_meta_tags 'og:site_name' => site_data['title']
56
+
57
+ fall_through(site_data, :title, 'title')
58
+ fall_through(site_data, :description, 'description')
59
+
60
+ # Twitter cards
61
+ fall_through(site_data, 'twitter:card', 'twitter_card', 'summary_large_image')
62
+ fall_through(site_data, 'twitter:creator', 'twitter_author')
63
+ fall_through(site_data, 'twitter:description', 'description')
64
+ fall_through(site_data, 'twitter:image:src', 'pull_image')
65
+ fall_through(site_data, 'twitter:site', 'publisher_twitter')
66
+ fall_through(site_data, 'twitter:title', 'title')
67
+
68
+ # Open Graph
69
+ fall_through(site_data, 'og:description', 'description')
70
+ fall_through(site_data, 'og:image', 'pull_image')
71
+ fall_through(site_data, 'og:title', 'title')
72
+ end
73
+
41
74
  private
42
75
 
76
+ def fall_through(site_data, name, key, default = nil)
77
+ value = current_page.data[key] || site_data[key] || default
78
+ set_meta_tags name => value unless value.blank?
79
+ value
80
+ end
81
+
43
82
  def full_title(meta_tags)
44
83
  separator = meta_tags[:separator] || '|'
45
84
  full_title = ''
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module MetaTags
3
- VERSION = '0.0.1'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = 'middleman-meta-tags'
8
8
  spec.version = Middleman::MetaTags::VERSION
9
9
  spec.authors = ['Baptiste Lecocq']
10
- spec.email = ['baptiste.lecocq@gmail.com']
10
+ spec.email = ['hello@tiste.io']
11
11
  spec.summary = %q{Meta tags for Middleman}
12
12
  spec.description = %q{Easy integration of meta tags into your Middleman applications}
13
13
  spec.homepage = 'https://github.com/tiste/middleman-meta-tags'
metadata CHANGED
@@ -1,65 +1,65 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-meta-tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.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: 2014-03-23 00:00:00.000000000 Z
11
+ date: 2014-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.5'
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
40
  version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: Easy integration of meta tags into your Middleman applications
56
56
  email:
57
- - baptiste.lecocq@gmail.com
57
+ - hello@tiste.io
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - CHANGELOG.md
64
64
  - Gemfile
65
65
  - LICENSE.txt
@@ -81,17 +81,17 @@ require_paths:
81
81
  - lib
82
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ! '>='
84
+ - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - ! '>='
89
+ - - ">="
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.0.6
94
+ rubygems_version: 2.2.2
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Meta tags for Middleman