seo_landing_pages 0.1.0 → 0.2.0
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 +27 -6
- data/lib/seo_landing_pages/helper.rb +41 -15
- data/lib/seo_landing_pages/version.rb +1 -1
- data/seo_landing_pages.gemspec +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cec4cab3f4abdb309717bd20fc068efc9e33b9c
|
4
|
+
data.tar.gz: 264bea4b83ed3efe70930eff90e22ecaaabb837a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d88d0a9d15a095145bac860aaf65b7ef98afe1a7c86bee32762b809109ffdd43a23b715d23c50db00382704be4f305619bc59698fcb256918f373dec821c91
|
7
|
+
data.tar.gz: 0700a977b0517f01d724561ad036092f93067b72fd839f9b0b2f7761708ad430ddffe21a47f08155d7f3931b1103127892358fa48e02b5fbaea96bcdab896b96
|
data/README.md
CHANGED
@@ -80,6 +80,25 @@ tag for you to concatenate them or so.
|
|
80
80
|
= seo_landing_page_keywords
|
81
81
|
```
|
82
82
|
|
83
|
+
### Internationalization support
|
84
|
+
|
85
|
+
For internationalization, instead of writing plain text in the title, description
|
86
|
+
and keywords write i18n keys, e.g. a landing page for your home page:
|
87
|
+
|
88
|
+
> SeoLandingPages::Model.create! slug: '/', title: 'title_home_page',
|
89
|
+
description: 'description_home_page',
|
90
|
+
keywords: 'keywords_home_page'
|
91
|
+
|
92
|
+
Create the translations in your locale files. Then use the view helpers like this:
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
= seo_landing_page_title_tag i18n: true
|
96
|
+
= seo_landing_page_description_tag i18n: true
|
97
|
+
= seo_landing_page_keywords_tag i18n: true
|
98
|
+
```
|
99
|
+
|
100
|
+
Now your pages have the HTML elements localized.
|
101
|
+
|
83
102
|
### Admin section
|
84
103
|
|
85
104
|
There's an Active Admin view provided, to get it run:
|
@@ -93,14 +112,11 @@ traffic increasing for your website.
|
|
93
112
|
|
94
113
|
## TODO
|
95
114
|
|
96
|
-
- write another CRUD admin section for those not using Active Admin
|
115
|
+
- write another CRUD admin section for those not using Active Admin, or accept
|
116
|
+
a Pull Request having it ;-)
|
117
|
+
- fix the TODOs in the code
|
97
118
|
- write tests
|
98
119
|
|
99
|
-
## Credits
|
100
|
-
|
101
|
-
This gem was developed in the [Hack Week at XING Barcelona](http://www.xing.com), Big
|
102
|
-
thanks to XING for providing the time to see ideas being realized.
|
103
|
-
|
104
120
|
## Contributing
|
105
121
|
|
106
122
|
1. Fork it ( https://github.com/joahking/seo_landing_pages/fork )
|
@@ -109,3 +125,8 @@ thanks to XING for providing the time to see ideas being realized.
|
|
109
125
|
4. Push to the branch (`git push origin my-new-feature`)
|
110
126
|
5. Create a new Pull Request
|
111
127
|
|
128
|
+
## Credits
|
129
|
+
|
130
|
+
This gem was developed in the [Hack Week at XING Barcelona](http://www.xing.com), Big
|
131
|
+
thanks to XING for providing the time to see ideas being realized.
|
132
|
+
|
@@ -3,47 +3,73 @@ module SeoLandingPages
|
|
3
3
|
module Helper
|
4
4
|
|
5
5
|
# Public: html title tag with the landing page title.
|
6
|
+
# - i18n: false = render plain text title. This is the default.
|
7
|
+
# true = title is an i18n key, so translate it.
|
6
8
|
# If the landing page title is empty it returns nothing.
|
7
|
-
def seo_landing_page_title_tag
|
8
|
-
|
9
|
-
|
9
|
+
def seo_landing_page_title_tag(i18n: false)
|
10
|
+
title = seo_landing_page_title i18n: i18n
|
11
|
+
if title
|
12
|
+
"<title>#{ title }</title>".html_safe
|
10
13
|
end
|
11
14
|
end
|
12
15
|
|
13
16
|
# Public: landing page title.
|
14
|
-
|
17
|
+
# - i18n: false = render plain text title. This is the default.
|
18
|
+
# true = title is an i18n key, so translate it.
|
19
|
+
def seo_landing_page_title(i18n: false)
|
15
20
|
if seo_current_landing_page
|
16
|
-
seo_current_landing_page.title
|
21
|
+
title = seo_current_landing_page.title
|
22
|
+
if title
|
23
|
+
i18n ? t(title) : title
|
24
|
+
end
|
17
25
|
end
|
18
26
|
end
|
19
27
|
|
20
28
|
# Public: html description meta tag with the landing page description.
|
29
|
+
# - i18n: false = render plain text description. This is the default.
|
30
|
+
# true = description is an i18n key, so translate it.
|
21
31
|
# If the landing page description is empty it returns nothing.
|
22
|
-
def seo_landing_page_description_tag
|
23
|
-
|
24
|
-
|
32
|
+
def seo_landing_page_description_tag(i18n: false)
|
33
|
+
description = seo_landing_page_description i18n: i18n
|
34
|
+
if description
|
35
|
+
"<meta name='description' content='#{ description }'/>".html_safe
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
28
39
|
# Public: landing page description.
|
29
|
-
|
40
|
+
# - i18n: false = render plain text description. This is the default.
|
41
|
+
# true = description is an i18n key, so translate it.
|
42
|
+
# If the landing page description is empty it returns nothing.
|
43
|
+
def seo_landing_page_description(i18n: false)
|
30
44
|
if seo_current_landing_page
|
31
|
-
seo_current_landing_page.description
|
45
|
+
description = seo_current_landing_page.description
|
46
|
+
if description
|
47
|
+
i18n ? t(description) : description
|
48
|
+
end
|
32
49
|
end
|
33
50
|
end
|
34
51
|
|
35
52
|
# Public: html keywords meta tag with the landing page keywords.
|
53
|
+
# - i18n: false = render plain text keywords. This is the default.
|
54
|
+
# true = keywords is an i18n key, so translate it.
|
36
55
|
# If the landing page keywords is empty it returns nothing.
|
37
|
-
def seo_landing_page_keywords_tag
|
38
|
-
|
39
|
-
|
56
|
+
def seo_landing_page_keywords_tag(i18n: false)
|
57
|
+
keywords = seo_landing_page_keywords i18n: i18n
|
58
|
+
if keywords
|
59
|
+
"<meta name='keywords' content='#{ keywords }'/>".html_safe
|
40
60
|
end
|
41
61
|
end
|
42
62
|
|
43
63
|
# Public: landing page keywords.
|
44
|
-
|
64
|
+
# - i18n: false = render plain text keywords. This is the default.
|
65
|
+
# true = keywords is an i18n key, so translate it.
|
66
|
+
# If the landing page keywords is empty it returns nothing.
|
67
|
+
def seo_landing_page_keywords(i18n: false)
|
45
68
|
if seo_current_landing_page
|
46
|
-
seo_current_landing_page.keywords
|
69
|
+
keywords = seo_current_landing_page.keywords
|
70
|
+
if keywords
|
71
|
+
i18n ? t(keywords) : keywords
|
72
|
+
end
|
47
73
|
end
|
48
74
|
end
|
49
75
|
|
data/seo_landing_pages.gemspec
CHANGED
@@ -11,12 +11,13 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = %q{Manage SEO key elements of landing pages in Rails easily.}
|
12
12
|
spec.description = %q{Create landing pages matching your pages, and manage their title, description and keywords in Rails easily.}
|
13
13
|
spec.homepage = 'https://github.com/joahking/seo-landing-pages'
|
14
|
-
spec.license =
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
|
+
spec.required_ruby_version = '~> 2'
|
20
21
|
|
21
22
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
23
|
spec.add_development_dependency 'rake', '~> 10'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seo_landing_pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joaquin Rivera Padron
|
@@ -93,9 +93,9 @@ require_paths:
|
|
93
93
|
- lib
|
94
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- - "
|
96
|
+
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: '
|
98
|
+
version: '2'
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|