class Para::SeoTools::MetaTags::Tags::Title

Public Instance Methods

value() click to toggle source
# File lib/para/seo_tools/meta_tags/tags/title.rb, line 6
def value
  meta_taggable_title || instance_title || action_name || model_name_translation
end

Private Instance Methods

action_name() click to toggle source
# File lib/para/seo_tools/meta_tags/tags/title.rb, line 28
def action_name
  if (action_name = action_i18n(:title))
    return action_name
  end
end
instance_title() click to toggle source
# File lib/para/seo_tools/meta_tags/tags/title.rb, line 17
def instance_title
  if instance
    Para::SeoTools.title_methods.each do |method|
      if instance.respond_to?(method) && (title = instance.send(method)).presence
        return title
      end
    end
    return nil
  end
end
meta_taggable_title() click to toggle source
# File lib/para/seo_tools/meta_tags/tags/title.rb, line 12
def meta_taggable_title
  instance && instance.meta_tagged? &&
    instance.meta_tags_list.meta_title.presence
end
model_name_translation() click to toggle source
# File lib/para/seo_tools/meta_tags/tags/title.rb, line 34
def model_name_translation
  return unless model_name
  model_key = "activerecord.models.#{ model_name }"

  if (translation = I18n.t("#{ model_key }.other", default: "").presence)
    translation
  elsif (translation = I18n.t(model_key, default: "").presence)
    translation.pluralize
  end
end