Sha256: 5086d2e388331e01dc136bd0e599f2ee5ebbf38271b715431827b6db0f610c28
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
module Cortex module Snippets module Client module Helper def snippet(options = {}, &block) snippets = webpage[:snippets] || [] snippet = snippets.find { |snippet| snippet[:document][:name] == options[:id] } if snippet.nil? || snippet[:document][:body].nil? || snippet[:document][:body].empty? content_tag(:snippet, capture(&block), options) else content_tag(:snippet, snippet[:document][:body].html_safe, options) end end def seo_title webpage[:seo_title] end def seo_description webpage[:seo_description] end def seo_keywords webpage[:seo_keyword_list] end def seo_robots robot_information = [] index_options = [:noindex, :nofollow, :noodp, :nosnippet, :noarchive, :noimageindex] index_options.each do |index_option| robot_information << index_option if webpage[index_option] end robot_information end def noindex webpage[:noindex] end def nofollow webpage[:nofollow] end def noodp webpage[:noodp] end def nosnippet webpage[:nosnippet] end def noarchive webpage[:noarchive] end def noimageindex webpage[:noimageindex] end def dynamic_yield { sku: webpage[:dynamic_yield_sku], category: webpage[:dynamic_yield_category] } end private def webpage Cortex::Snippets::Client::current_webpage(request) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cortex-snippets-client-0.8.1 | lib/cortex/snippets/client/helper.rb |
cortex-snippets-client-0.8.0 | lib/cortex/snippets/client/helper.rb |