middleman-meta-tags 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +62 -0
- data/Rakefile +1 -0
- data/lib/middleman-meta-tags.rb +6 -0
- data/lib/middleman-meta-tags/extension.rb +11 -0
- data/lib/middleman-meta-tags/helpers.rb +63 -0
- data/lib/middleman-meta-tags/version.rb +5 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-meta-tags.gemspec +25 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
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=
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Middleman MetaTags
|
2
|
+
|
3
|
+
SEO gem for your Middleman apps.
|
4
|
+
|
5
|
+
Based on [meta-tags](https://github.com/kpumuk/meta-tags) Rails gem.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'middleman-meta-tags'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install middleman-meta-tags
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### Title
|
24
|
+
|
25
|
+
```rb
|
26
|
+
set_meta_tags title: 'My Awesome Website'
|
27
|
+
title 'My Awesome Website'
|
28
|
+
```
|
29
|
+
|
30
|
+
### Description
|
31
|
+
|
32
|
+
```rb
|
33
|
+
set_meta_tags description: 'Powerful website full of best practices and keywords'
|
34
|
+
description 'Powerful website full of best practices and keywords'
|
35
|
+
```
|
36
|
+
|
37
|
+
### Keywords
|
38
|
+
|
39
|
+
```rb
|
40
|
+
set_meta_tags keywords: %w(some seo keywords).join(', ')
|
41
|
+
keywords %w(some seo keywords).join(', ')
|
42
|
+
```
|
43
|
+
|
44
|
+
## Display meta tags
|
45
|
+
|
46
|
+
Into your `<head></head>` tag:
|
47
|
+
|
48
|
+
```rb
|
49
|
+
display_meta_tags site: 'My Awesome Website'
|
50
|
+
```
|
51
|
+
|
52
|
+
By default, there is a `|` as separator between title and website name.
|
53
|
+
|
54
|
+
You can modify it by adding: `separator: '»'`
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
1. [Fork it](http://github.com/tiste/middleman-meta-tags/fork)
|
59
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
60
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
61
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
62
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Middleman
|
2
|
+
module MetaTags
|
3
|
+
module Helpers
|
4
|
+
def meta_tags
|
5
|
+
@meta_tags ||= {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def set_meta_tags(meta_tags = {})
|
9
|
+
self.meta_tags.merge! meta_tags
|
10
|
+
end
|
11
|
+
|
12
|
+
def description(description = nil)
|
13
|
+
set_meta_tags(description: description) unless description.nil?
|
14
|
+
end
|
15
|
+
|
16
|
+
def keywords(keywords = nil)
|
17
|
+
set_meta_tags(keywords: keywords) unless keywords.nil?
|
18
|
+
end
|
19
|
+
|
20
|
+
def title(title = nil)
|
21
|
+
set_meta_tags(title: title) unless title.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
def display_meta_tags(default = {})
|
25
|
+
result = []
|
26
|
+
meta_tags = default.merge(self.meta_tags)
|
27
|
+
|
28
|
+
title = full_title(meta_tags)
|
29
|
+
result << content_tag(:title, title) unless title.blank?
|
30
|
+
|
31
|
+
description = safe_description(meta_tags.delete(:description))
|
32
|
+
result << tag(:meta, name: :description, content: description) unless description.blank?
|
33
|
+
|
34
|
+
keywords = meta_tags.delete(:keywords)
|
35
|
+
result << tag(:meta, name: :keywords, content: keywords) unless keywords.blank?
|
36
|
+
|
37
|
+
result = result.join("\n")
|
38
|
+
result.html_safe
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def full_title(meta_tags)
|
44
|
+
separator = meta_tags[:separator] || '|'
|
45
|
+
full_title = ''
|
46
|
+
title = safe_title(meta_tags[:title])
|
47
|
+
|
48
|
+
(full_title << title) unless title.blank?
|
49
|
+
(full_title << " #{separator} ") unless title.blank? || meta_tags[:site].blank?
|
50
|
+
(full_title << meta_tags[:site]) unless meta_tags[:site].blank?
|
51
|
+
full_title
|
52
|
+
end
|
53
|
+
|
54
|
+
def safe_description(description)
|
55
|
+
truncate(strip_tags(description), length: 200)
|
56
|
+
end
|
57
|
+
|
58
|
+
def safe_title(title)
|
59
|
+
title = strip_tags(title)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'middleman-meta-tags'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'middleman-meta-tags/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'middleman-meta-tags'
|
8
|
+
spec.version = Middleman::MetaTags::VERSION
|
9
|
+
spec.authors = ['Baptiste Lecocq']
|
10
|
+
spec.email = ['baptiste.lecocq@gmail.com']
|
11
|
+
spec.summary = %q{Meta tags for Middleman}
|
12
|
+
spec.description = %q{Easy integration of meta tags into your Middleman applications}
|
13
|
+
spec.homepage = 'https://github.com/tiste/middleman-meta-tags'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'middleman-core', ['>= 3.0.0']
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.5'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-meta-tags
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Baptiste Lecocq
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Easy integration of meta tags into your Middleman applications
|
56
|
+
email:
|
57
|
+
- baptiste.lecocq@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- CHANGELOG.md
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- lib/middleman-meta-tags.rb
|
69
|
+
- lib/middleman-meta-tags/extension.rb
|
70
|
+
- lib/middleman-meta-tags/helpers.rb
|
71
|
+
- lib/middleman-meta-tags/version.rb
|
72
|
+
- lib/middleman_extension.rb
|
73
|
+
- middleman-meta-tags.gemspec
|
74
|
+
homepage: https://github.com/tiste/middleman-meta-tags
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.0.6
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Meta tags for Middleman
|
98
|
+
test_files: []
|