seorel 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +25 -2
- data/lib/seorel/controller/instance_methods.rb +1 -1
- data/lib/seorel/controller/params.rb +17 -2
- data/lib/seorel/version.rb +1 -1
- metadata +8 -11
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Mzg2YTc1MWI1OTdlNDMxM2VjN2RmMTFmOGFlYjQ2NjQ0MDk2YThiNw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NGJlMGIzMmUxZmIyOGRhYWJmMWU1MjcxYjc0MGY5Yjg2OTU2YTA5OA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YWEzNGFiMzY5YjJjMDJmNmQwOGU2ZjMzOTVkMDZkNmJkMGNhMGNmODYwMDZl
|
10
|
+
YWU2Y2IzYzAzYTA0ODc0NTcwZjNlNWQxMWY5MmU4MjAzMTMwNTEzOWFiNDIz
|
11
|
+
MWE5Y2I5ZmQxYTUxM2ZlZTYyOTRhZDI5MzFjOWQ1ODBjOTA5MGU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Yzg2MWVjYjcyZTViZjhhMDdiN2UxZjY5OTBhNDhhZDE4MTIxNTRhNzdkZDEy
|
14
|
+
ODA5MmRjN2QwODA2Y2E1NGU0NGQ2ZmQwODFjOWFmZTJlM2U1YTQ0NTcyNjU2
|
15
|
+
MWZmNDFmOTJlMGZiNjg2M2Y2NzU1NWZhNGVlNTg4NGZjMzkzZGM=
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Ruby on Rails SEO Metatags plugins for ActiveRecord models
|
|
10
10
|
`Gemfile.rb`:
|
11
11
|
|
12
12
|
```ruby
|
13
|
-
gem 'seorel', '~> 0.0.
|
13
|
+
gem 'seorel', '~> 0.0.3'
|
14
14
|
|
15
15
|
# the edge version can be had using:
|
16
16
|
# gem 'seorel', github: 'dalpo/seorel'
|
@@ -45,7 +45,7 @@ end
|
|
45
45
|
|
46
46
|
## Usage
|
47
47
|
|
48
|
-
###
|
48
|
+
### Model
|
49
49
|
|
50
50
|
For instance generate a post model:
|
51
51
|
```ruby
|
@@ -96,9 +96,32 @@ class PostsController < ApplicationController
|
|
96
96
|
...
|
97
97
|
end
|
98
98
|
|
99
|
+
def history
|
100
|
+
...
|
101
|
+
end
|
99
102
|
end
|
100
103
|
```
|
101
104
|
|
105
|
+
In case of missing `add_metatags` for controller actions, you can define metatags through rails `L10n` library by defining your locale strings for seorel.
|
106
|
+
|
107
|
+
For instance `seorel.en.yml`:
|
108
|
+
|
109
|
+
```yaml
|
110
|
+
# encoding: utf-8
|
111
|
+
en:
|
112
|
+
seorel:
|
113
|
+
posts:
|
114
|
+
history:
|
115
|
+
title: "Posts history metatitle"
|
116
|
+
description: "Posts history metadescriprion"
|
117
|
+
|
118
|
+
tags:
|
119
|
+
index:
|
120
|
+
title: "Tag list"
|
121
|
+
description: "Tag list metadescription"
|
122
|
+
```
|
123
|
+
Where `posts` and `tags` are controller names, while `history` and `index` are their actions.
|
124
|
+
|
102
125
|
### Views
|
103
126
|
|
104
127
|
In your layout <head></head> section just call the `render_meta_tags` helper:
|
@@ -10,16 +10,20 @@ module Seorel
|
|
10
10
|
config_accessor :description
|
11
11
|
config_accessor :image
|
12
12
|
|
13
|
+
def initialize(controller)
|
14
|
+
@controller = controller
|
15
|
+
end
|
16
|
+
|
13
17
|
def full_title
|
14
18
|
[default_options.prepend_title, self.title, default_options.append_title].compact.join
|
15
19
|
end
|
16
20
|
|
17
21
|
def title
|
18
|
-
config.title || default_options.default_title
|
22
|
+
config.title || I18n.t(i18n_path(:title), default: default_options.default_title)
|
19
23
|
end
|
20
24
|
|
21
25
|
def description
|
22
|
-
config.description || default_options.default_description
|
26
|
+
config.description || I18n.t(i18n_path(:description), default: default_options.default_description)
|
23
27
|
end
|
24
28
|
|
25
29
|
def image
|
@@ -29,6 +33,17 @@ module Seorel
|
|
29
33
|
def default_options
|
30
34
|
::Seorel.config
|
31
35
|
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
def controller
|
40
|
+
@controller
|
41
|
+
end
|
42
|
+
|
43
|
+
def i18n_path(key)
|
44
|
+
"seorel.#{controller.controller_name}.#{controller.action_name}.#{key}"
|
45
|
+
end
|
46
|
+
|
32
47
|
end
|
33
48
|
end
|
34
49
|
end
|
data/lib/seorel/version.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seorel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Andrea Dal Ponte
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -92,29 +89,29 @@ files:
|
|
92
89
|
- test/test_helper.rb
|
93
90
|
- test/unit/seorel/seorel_test.rb
|
94
91
|
homepage: https://github.com/dalpo/seorel
|
95
|
-
licenses:
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
96
95
|
post_install_message:
|
97
96
|
rdoc_options: []
|
98
97
|
require_paths:
|
99
98
|
- lib
|
100
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
100
|
requirements:
|
103
101
|
- - ! '>='
|
104
102
|
- !ruby/object:Gem::Version
|
105
103
|
version: '0'
|
106
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
105
|
requirements:
|
109
106
|
- - ! '>='
|
110
107
|
- !ruby/object:Gem::Version
|
111
108
|
version: '0'
|
112
109
|
requirements: []
|
113
110
|
rubyforge_project:
|
114
|
-
rubygems_version: 1.
|
111
|
+
rubygems_version: 2.1.10
|
115
112
|
signing_key:
|
116
|
-
specification_version:
|
117
|
-
summary: Ruby on Rails SEO Metatags
|
113
|
+
specification_version: 4
|
114
|
+
summary: Ruby on Rails SEO Metatags engine for ActiveRecord models
|
118
115
|
test_files:
|
119
116
|
- test/dummy/app/assets/javascripts/application.js
|
120
117
|
- test/dummy/app/assets/stylesheets/application.css
|