seo_fuel 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
1
|
## version 0.0.5
|
2
2
|
- copy locale files to config folder upon installation
|
3
3
|
- the button is now included in the same view helper as the dialog. Only use `<%= edit_seo_dialog %>` now
|
4
|
+
|
5
|
+
|
6
|
+
## version 0.0.8
|
7
|
+
- updated README
|
8
|
+
- added option to create default description and default keywords
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ _This gem is still in early development. Described features work, but some featu
|
|
4
4
|
|
5
5
|
SEO Fuel is a super easy way to manage SEO tags in your Rails app. It doesn't require any adjustments to existing models or controllers.
|
6
6
|
|
7
|
-
![Edit SEO right in your browser](
|
7
|
+
![Edit SEO right in your browser](http://server6.dagjeweg.nl/bestanden/seo_fuel_example.png "Example Usage")
|
8
8
|
|
9
9
|
## Philosophy
|
10
10
|
Where to put SEO? The main idea behind this gem is that end users often want to be able to fine tune SEO settings right in the browser, without going to some sort of backend or options file.
|
@@ -17,7 +17,7 @@ SEO Fuel makes it realy easy to have total control of the meta tags, while still
|
|
17
17
|
|
18
18
|
Add this line to your application's Gemfile:
|
19
19
|
|
20
|
-
gem 'seo_fuel'
|
20
|
+
gem 'seo_fuel', git: "https://github.com/henkm/seo_fuel.git"
|
21
21
|
|
22
22
|
And then execute:
|
23
23
|
|
@@ -59,11 +59,12 @@ or, if you wish to only let signed in users be able to see the form (using devse
|
|
59
59
|
<%= edit_seo_dialog if admin_signed_in? %>
|
60
60
|
|
61
61
|
### Setting default values
|
62
|
-
By default, all
|
62
|
+
By default, all meta tags are blank. If a tag is blank, the one specified in `seo_fuel_settings.yml` should be used (NOT YET IMPLEMENTED). Per template, you can specify a default value by adding a few lines of code to your view template. These values take precedence over the default values.
|
63
63
|
The 'in browser' added SEO settings take precedence over all default values.
|
64
64
|
|
65
65
|
<% default_title("Site Name | #{@article.title}") %>
|
66
|
-
|
66
|
+
<% default_description(@article.summary) %>
|
67
|
+
<% default_keywords(@article.categories.map(&:name).join(',')) %>
|
67
68
|
|
68
69
|
### I18n
|
69
70
|
This gem is fully I18n adjustable. Just edit the locale file, placed in the locales directory of your Rails app.
|
@@ -1 +1 @@
|
|
1
|
-
<meta name="description" content="<%=
|
1
|
+
<meta name="description" content="<%= description_to_show %>">
|
@@ -1 +1 @@
|
|
1
|
-
<meta name="keywords" content="<%=
|
1
|
+
<meta name="keywords" content="<%= keywords_to_show %>">
|
@@ -6,10 +6,10 @@
|
|
6
6
|
<%= f.text_field :title, placeholder: @default_title %>
|
7
7
|
<div class="spacer"></div>
|
8
8
|
<%= f.label :description, "#{I18n.t('seo.form.description')}".html_safe %>
|
9
|
-
<%= f.text_area :description, rows: 3 %>
|
9
|
+
<%= f.text_area :description, rows: 3, placeholder: @default_description %>
|
10
10
|
<div class="spacer"></div>
|
11
11
|
<%= f.label :keywords, "#{I18n.t('seo.form.keywords')}".html_safe %>
|
12
|
-
<%= f.text_area :keywords, rows: 3 %>
|
12
|
+
<%= f.text_area :keywords, rows: 3, placeholder: @default_keywords %>
|
13
13
|
<div class="spacer"></div>
|
14
14
|
<%= link_to I18n.t('seo.cancel'), "#", id: "cancel_seo_btn"%>
|
15
15
|
<%= f.submit I18n.t('seo.save')%>
|
data/lib/seo_fuel/version.rb
CHANGED
data/lib/seo_fuel/view_helper.rb
CHANGED
@@ -16,6 +16,44 @@ module SeoFuel
|
|
16
16
|
@default_title = title.force_encoding('utf-8')
|
17
17
|
end
|
18
18
|
|
19
|
+
|
20
|
+
# set your default description in any view template, by
|
21
|
+
# simply calling `default_description(your_description_here)`
|
22
|
+
# this description takes precedence over the default description set
|
23
|
+
# in your config file, but not over the one set 'in browser'
|
24
|
+
def default_description(description)
|
25
|
+
@default_description = description.force_encoding('utf-8')
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# determines wich description to show
|
30
|
+
def description_to_show
|
31
|
+
if current_page && current_page.description.present?
|
32
|
+
current_page.description
|
33
|
+
elsif @default_description.present?
|
34
|
+
@default_description
|
35
|
+
else
|
36
|
+
""
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# set your default keywords in any view template
|
41
|
+
def default_keywords(keywords)
|
42
|
+
@default_keywords = keywords.force_encoding('utf-8')
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
# determines wich description to show
|
47
|
+
def keywords_to_show
|
48
|
+
if current_page && current_page.keywords.present?
|
49
|
+
current_page.keywords
|
50
|
+
elsif @default_keywords.present?
|
51
|
+
@default_keywords
|
52
|
+
else
|
53
|
+
""
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
19
57
|
# determines wich title to show
|
20
58
|
def title_to_show
|
21
59
|
if current_page && current_page.title.present?
|