jt-rails-meta 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +34 -0
- data/jt-rails-meta.gemspec +1 -1
- data/lib/generators/jt/meta/templates/meta.yml +18 -9
- data/lib/jt-rails-meta.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df8baf0be37cec984c47caea2df269669b9b2ee8
|
4
|
+
data.tar.gz: 8881f4596e242159e3b8ae3fe90fbc71e0bda342
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c56f88e7e722e19c9626f68ff85779d17c8bda937319f09f6949e6984e589a38865ca7b0694abd463ea74c2e87b3a820925a0436f6598a2949b92bfaa112f01d
|
7
|
+
data.tar.gz: 6b244eafeab123df38341fd5474b5e38b25c62082ee2edddcd089379a5321c7bba193c7be6832a23e0bdd0478228be138f4c57d16414cf1411bf8e65296db2d7
|
data/README.md
CHANGED
@@ -43,6 +43,40 @@ Call `meta_tags` in your layout:
|
|
43
43
|
|
44
44
|
You have also access to `meta_title`, `meta_description`, `meta_keywords` methods.
|
45
45
|
|
46
|
+
Define your meta in `meta.yml` file:
|
47
|
+
|
48
|
+
```yaml
|
49
|
+
en:
|
50
|
+
meta:
|
51
|
+
# in general you use either prefx or suffix for the title of your page
|
52
|
+
# prefix or suffix are not applied on default title and are both optional
|
53
|
+
prefix: "My Website - "
|
54
|
+
suffix: " - My Website"
|
55
|
+
|
56
|
+
# default meta used if no meta are found for a page
|
57
|
+
default:
|
58
|
+
title: My WebSite
|
59
|
+
description: My super website is about something magnificent
|
60
|
+
keywords: "website, some keywords"
|
61
|
+
|
62
|
+
# Exemple of meta for the controller users and the action new
|
63
|
+
# title, full_title, description and keywords are all optional
|
64
|
+
users:
|
65
|
+
new:
|
66
|
+
title: Sign up
|
67
|
+
description: Description of sign up page
|
68
|
+
keywords: "sign up, registration"
|
69
|
+
|
70
|
+
# Another example for the controller home and the action index
|
71
|
+
# full_title is used if exceptionally you don't want to use the prefix or suffix
|
72
|
+
# you can use either title or full_title
|
73
|
+
home:
|
74
|
+
index:
|
75
|
+
full_title: Home
|
76
|
+
description: Description of homepage
|
77
|
+
|
78
|
+
```
|
79
|
+
|
46
80
|
### Pass parameters to tags
|
47
81
|
|
48
82
|
In your controller:
|
data/jt-rails-meta.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.summary = "Manage HTML meta tags for SEO in Ruby On Rails"
|
4
4
|
s.description = "JTRailsMeta help you to manage HTML meta tags like title, description, keywords used in Search Engine Optimization (SEO)."
|
5
5
|
s.homepage = 'https://github.com/jonathantribouharet/jt-rails-meta'
|
6
|
-
s.version = '1.0.
|
6
|
+
s.version = '1.0.4'
|
7
7
|
s.files = `git ls-files`.split("\n")
|
8
8
|
s.require_paths = ['lib']
|
9
9
|
s.authors = ['Jonathan TRIBOUHARET']
|
@@ -1,10 +1,9 @@
|
|
1
1
|
en:
|
2
2
|
meta:
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
suffix: " - My Website" # Optional
|
3
|
+
# in general you use either prefx or suffix for the title of your page
|
4
|
+
# prefix or suffix are not applied on default title and are both optional
|
5
|
+
prefix: "My Website - "
|
6
|
+
suffix: " - My Website"
|
8
7
|
|
9
8
|
# default meta used if no meta are found for a page
|
10
9
|
default:
|
@@ -12,10 +11,20 @@ en:
|
|
12
11
|
description: My super website is about something magnificent
|
13
12
|
keywords: "website, some keywords"
|
14
13
|
|
15
|
-
# Exemple of meta for the controller
|
16
|
-
# title, description and keywords are optional
|
14
|
+
# Exemple of meta for the controller users and the action new
|
15
|
+
# title, full_title, description and keywords are all optional
|
16
|
+
users:
|
17
|
+
new:
|
18
|
+
title: Sign up
|
19
|
+
description: Description of sign up page
|
20
|
+
keywords: "sign up, registration"
|
21
|
+
|
22
|
+
# Another example for the controller home and the action index
|
23
|
+
# full_title is used if exceptionally you don't want to use the prefix or suffix
|
24
|
+
# you can use either title or full_title
|
17
25
|
home:
|
18
26
|
index:
|
19
|
-
|
27
|
+
full_title: Home
|
20
28
|
description: Description of homepage
|
21
|
-
|
29
|
+
|
30
|
+
|
data/lib/jt-rails-meta.rb
CHANGED
@@ -59,11 +59,12 @@ module JT::Rails::Meta
|
|
59
59
|
# +options+:: options passed to I18n
|
60
60
|
def set_meta_title(options = {})
|
61
61
|
@meta[:title] = I18n.translate("#{meta_key}.title", options)
|
62
|
-
|
63
|
-
if
|
64
|
-
@meta[:title] = I18n.translate('meta.default.title')
|
65
|
-
else
|
62
|
+
|
63
|
+
if have_translation?(@meta[:title])
|
66
64
|
@meta[:title] = "#{@meta[:prefix]}#{I18n.translate("#{meta_key}.title", options)}#{@meta[:suffix]}"
|
65
|
+
else
|
66
|
+
@meta[:title] = I18n.translate("#{meta_key}.full_title", options)
|
67
|
+
@meta[:title] = I18n.translate('meta.default.title') if !have_translation?(@meta[:title])
|
67
68
|
end
|
68
69
|
|
69
70
|
@meta[:title]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jt-rails-meta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan TRIBOUHARET
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: JTRailsMeta help you to manage HTML meta tags like title, description,
|
14
14
|
keywords used in Search Engine Optimization (SEO).
|