class Agave::Utils::MetaTags::Base
Attributes
item[R]
site[R]
Public Class Methods
new(item, site)
click to toggle source
# File lib/agave/utils/meta_tags/base.rb, line 12 def initialize(item, site) @item = item @site = site end
Public Instance Methods
card_tag(name, content)
click to toggle source
# File lib/agave/utils/meta_tags/base.rb, line 45 def card_tag(name, content) meta_tag(name, content) end
content_tag(tag_name, content)
click to toggle source
# File lib/agave/utils/meta_tags/base.rb, line 49 def content_tag(tag_name, content) { tag_name: tag_name, content: content } end
meta_tag(name, content)
click to toggle source
# File lib/agave/utils/meta_tags/base.rb, line 37 def meta_tag(name, content) tag('meta', name: name, content: content) end
og_tag(property, content)
click to toggle source
# File lib/agave/utils/meta_tags/base.rb, line 41 def og_tag(property, content) tag('meta', property: property, content: content) end
seo_field_with_fallback(attribute, alternative)
click to toggle source
# File lib/agave/utils/meta_tags/base.rb, line 17 def seo_field_with_fallback(attribute, alternative) fallback_seo = site.global_seo && site.global_seo.fallback_seo seo_field = item && item.fields.detect { |f| f.field_type == 'seo' } item_seo_value = seo_field && item.send(seo_field.api_key) && item.send(seo_field.api_key).send(attribute) fallback_seo_value = fallback_seo && fallback_seo.send(attribute) item_seo_value || alternative || fallback_seo_value end
tag(tag_name, attributes)
click to toggle source
# File lib/agave/utils/meta_tags/base.rb, line 33 def tag(tag_name, attributes) { tag_name: tag_name, attributes: attributes } end