Module: CamaleonCms::Frontend::SeoHelper

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

Overview

Camaleon CMS is a content management system

Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  GNU Affero General Public License (GPLv3) for more details.

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(…)


37
38
39
40
# File 'app/helpers/camaleon_cms/frontend/seo_helper.rb', line 37

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(…)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/helpers/camaleon_cms/frontend/seo_helper.rb', line 13

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 = {image: @cama_visited_tag.the_thumb_url, 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