so_meta 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +73 -0
- data/Rakefile +1 -0
- data/lib/so_meta.rb +6 -0
- data/lib/so_meta/helper.rb +12 -0
- data/lib/so_meta/railtie.rb +9 -0
- data/lib/so_meta/version.rb +3 -0
- data/so_meta.gemspec +23 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7cc31b12ab439bf5fbfac0762045583ad50ff114
|
4
|
+
data.tar.gz: 8ba12f7521896e191c1a720eba78c968674acd9f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0a3ff149424b408af6a6857029916acca7bef5c72cf5ca0d809716982367b20dfe59a2dc6eedc32b85acbaa8b686d0e3e4edd402dcd6e1dc879adc3e0d4b9d1e
|
7
|
+
data.tar.gz: 57dbce88cfa6e56aff0a18ed5ae9274210ffbfd9a26d014c261000e0c0204c739a7033136b152a46f267409d9f90615a463c35e17d040e27df1933dca2abc6c8
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Brandon Hilkert
|
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,73 @@
|
|
1
|
+
# So Meta
|
2
|
+
|
3
|
+
So Meta is a gem to simply manage meta content (title, description, canonical url, etc.) from within a Rails application
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'so_meta'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install so_meta
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
So Meta uses the localization file to provide easy to modify SEO text content for page titles, descriptions and other text content for layouts and views.
|
22
|
+
|
23
|
+
```YAML
|
24
|
+
# config/locales/en.yml
|
25
|
+
|
26
|
+
en:
|
27
|
+
so_meta:
|
28
|
+
defaults:
|
29
|
+
title: "My Awesome New Rails Application"
|
30
|
+
description: "This application will be so viral, your startup
|
31
|
+
friends will be JEALOUS!"
|
32
|
+
|
33
|
+
pages: # Controller name - PagesController
|
34
|
+
about: # Action name - about
|
35
|
+
title: "About | My Awesome New Rails Application"
|
36
|
+
description: "Our company will blow your mind...like really."
|
37
|
+
|
38
|
+
contact:
|
39
|
+
title: "Contact %{name} | My Awesome New Rails Application" # Interpolation content from the view
|
40
|
+
# By not specifying a description for this page, it'll inherit the defaults
|
41
|
+
```
|
42
|
+
|
43
|
+
```Erb
|
44
|
+
<!-- views/layouts/application.html.erb -->
|
45
|
+
|
46
|
+
<!DOCTYPE html>
|
47
|
+
<html lang="en">
|
48
|
+
<head>
|
49
|
+
<title><%= so_meta(:title) %></title>
|
50
|
+
<meta name="description" content="<%= so_meta(:description) %>" />
|
51
|
+
<%= csrf_meta_tags %>
|
52
|
+
</head>
|
53
|
+
<body>
|
54
|
+
</body>
|
55
|
+
</html>
|
56
|
+
```
|
57
|
+
|
58
|
+
```Erb
|
59
|
+
<!-- app/views/pages/contact.html.erb -->
|
60
|
+
|
61
|
+
<% so_meta_interpolation :title, name: "Brandon" %>
|
62
|
+
|
63
|
+
<h1>Contact</h1>
|
64
|
+
<p>Contact us now!</p>
|
65
|
+
```
|
66
|
+
|
67
|
+
## Contributing
|
68
|
+
|
69
|
+
1. Fork it
|
70
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
71
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
72
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/so_meta.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
module SoMeta
|
2
|
+
module Helper
|
3
|
+
def so_meta(name)
|
4
|
+
interpolation_data = instance_variable_get("@so_meta_#{name}_interpolation") || {}
|
5
|
+
t("so_meta.#{controller_name}.#{action_name}.#{name}", interpolation_data.merge(default: t("so_meta.defaults.#{name}")))
|
6
|
+
end
|
7
|
+
|
8
|
+
def so_meta_interpolation(name, hash)
|
9
|
+
instance_variable_set("@so_meta_#{name}_interpolation", hash)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/so_meta.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'so_meta/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "so_meta"
|
8
|
+
spec.version = SoMeta::VERSION
|
9
|
+
spec.authors = ["Brandon Hilkert"]
|
10
|
+
spec.email = ["brandonhilkert@gmail.com"]
|
11
|
+
spec.description = %q{A gem to simply manage meta content (title, description, canonical url, etc.) from within a Rails application.}
|
12
|
+
spec.summary = %q{A gem to simply manage meta content (title, description, canonical url, etc.) from within a Rails application.}
|
13
|
+
spec.homepage = "https://github.com/brandonhilkert/so_meta"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
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_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: so_meta
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Hilkert
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A gem to simply manage meta content (title, description, canonical url,
|
42
|
+
etc.) from within a Rails application.
|
43
|
+
email:
|
44
|
+
- brandonhilkert@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- lib/so_meta.rb
|
55
|
+
- lib/so_meta/helper.rb
|
56
|
+
- lib/so_meta/railtie.rb
|
57
|
+
- lib/so_meta/version.rb
|
58
|
+
- so_meta.gemspec
|
59
|
+
homepage: https://github.com/brandonhilkert/so_meta
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: A gem to simply manage meta content (title, description, canonical url, etc.)
|
83
|
+
from within a Rails application.
|
84
|
+
test_files: []
|