Module: CamaleonCms::Frontend::SeoHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/camaleon_cms/frontend/seo_helper.rb

Instance Method Summary collapse

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(“my custom title”, description: “my descr”, keywords: “my keywords”, image: ‘my img url’) This values will be shown within the_head(…)



29
30
31
32
# File 'app/helpers/camaleon_cms/frontend/seo_helper.rb', line 29

def cama_seo_settings(options)
  @_cama_seo_setting_values ||= {}
  @_cama_seo_setting_values = @_cama_seo_setting_values.merge(options)
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(…)



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/camaleon_cms/frontend/seo_helper.rb', line 5

def cama_the_seo(data = {})
  if is_home?
    data2 = {}
  elsif is_page?
    data2 = {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?
    data2 = {}
  elsif is_search?
    data2 = {title: "#{current_site.the_title} | #{ct("search_title", default: "Search")}"}
  elsif is_post_type?
    data2 = {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 
    data2 = {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?
    data2 = {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 }
  else
    data2 = {}
  end
  cama_build_seo(data2.merge(@_cama_seo_setting_values || {}).merge(data))
end