module SeoSensei::Controllers::Helpers

Public Instance Methods

disable_seo(options = {}) click to toggle source
# File lib/seo_sensei/controllers/helpers.rb, line 22
def disable_seo(options = {})
  before_action(options) do
    set_meta_tags(noindex: true)
  end
end
enable_seo(options = {}) click to toggle source
# File lib/seo_sensei/controllers/helpers.rb, line 9
def enable_seo(options = {})
  before_action(options) do
    resource_name = options.delete(:for) || controller_name
    if (translated_seo = ::SeoSensei::Lookup.call(controller_name: resource_name, action_name: action_name))
      attributes_service = ::SeoSensei::SeoAttributes.new(
        translated_seo, nil, url_for(only_path: false)
      )

      set_meta_tags(attributes_service.call)
    end
  end
end
seo_tags_with(resource) click to toggle source
# File lib/seo_sensei/controllers/helpers.rb, line 29
def seo_tags_with(resource)
  if (translated_seo = ::SeoSensei::Lookup.call(controller_name: controller_name, action_name: action_name, resource: resource))
    attributes_service = ::SeoSensei::SeoAttributes.new(
      translated_seo, resource, url_for(only_path: false)
    )

    set_meta_tags(attributes_service.call)
  end
end