Module: CamaleonCms::Frontend::SeoHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/camaleon_cms/frontend/seo_helper.rb
Instance Method Summary collapse
-
#cama_seo_settings(options) ⇒ Object
permit to define seo attributes by code without hooks (check here for more attributes: github.com/kpumuk/meta-tags) @Sample: cama_seo_settings( “my custom title”, description: “my descr”, keywords: “my keywords”, image: ‘my img url’ ) This values will be shown within the_head(…).
-
#cama_the_seo(data = {}) ⇒ Object
add seo attributes to your page you can pass custom data to overwrite default data generated by the system return hash of seo attributes used by the_head(…).
Instance Method Details
#cama_seo_settings(options) ⇒ Object
permit to define seo attributes by code without hooks (check here for more attributes: github.com/kpumuk/meta-tags) @Sample: cama_seo_settings(
{title: "my custom title", description: "my descr", keywords: "my keywords", image: 'my img url'}
) This values will be shown within the_head(…)
53 54 55 56 |
# File 'app/helpers/camaleon_cms/frontend/seo_helper.rb', line 53 def cama_seo_settings() @_cama_seo_setting_values ||= {} @_cama_seo_setting_values = @_cama_seo_setting_values.merge() end |
#cama_the_seo(data = {}) ⇒ Object
add seo attributes to your page you can pass custom data to overwrite default data generated by the system return hash of seo attributes used by the_head(…)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/helpers/camaleon_cms/frontend/seo_helper.rb', line 7 def cama_the_seo(data = {}) data2 = if is_home? {} elsif is_page? { image: @cama_visited_post.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_post.the_title}", description: @cama_visited_post.the_excerpt, keywords: @cama_visited_post.the_keywords, object: @cama_visited_post } elsif is_ajax? {} elsif is_search? { title: "#{current_site.the_title} | #{ct('search_title', default: 'Search')}" } elsif is_post_type? { image: @cama_visited_post_type.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_post_type.the_title}", description: @cama_visited_post_type.the_excerpt, keywords: @cama_visited_post_type.the_keywords, object: @cama_visited_post_type } elsif is_post_tag? { title: "#{current_site.the_title} | #{@cama_visited_tag.the_title}", description: @cama_visited_tag.the_excerpt, keywords: @cama_visited_tag.the_keywords, object: @cama_visited_tag } elsif is_category? { image: @cama_visited_category.the_thumb_url, title: "#{current_site.the_title} | #{@cama_visited_category.the_title}", description: @cama_visited_category.the_excerpt, keywords: @cama_visited_category.the_keywords, object: @cama_visited_category } elsif is_profile? { image: @user.the_avatar, title: "#{current_site.the_title} | #{@user.the_name}", description: @user.the_slogan, object: @user } else {} end cama_build_seo(data2.merge!(@_cama_seo_setting_values || {}).merge(data)) end |