Sha256: 45bb928f06e6d0a23dc52e309d78c81d51c161e8853bba4a18f30d68e55f27f1

Contents?: true

Size: 674 Bytes

Versions: 4

Compression:

Stored size: 674 Bytes

Contents

module TopHat
  module RobotsHelper

    DEFAULT_DESCRIPTOR = 'robots'

    def noindex(descriptor = nil, content = 'noindex')
      robot_tag(descriptor, content)
    end

    def nofollow(descriptor = nil, content = 'nofollow')
      robot_tag(descriptor, content)
    end

    def robot_tag(descriptor = nil, content)
      if descriptor
        TopHat.current[content] = descriptor || DEFAULT_DESCRIPTOR
      else
        descriptor = TopHat.current[content] || DEFAULT_DESCRIPTOR
      end
      tag(:meta, :name => descriptor, :content => content)
    end

    def canonical(path = nil)
      tag(:link, :rel => 'canonical', :href => path) if path
    end

  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/tophat-2.3.1/lib/tophat/robots.rb
tophat-2.3.1 lib/tophat/robots.rb
tophat-2.3.0 lib/tophat/robots.rb
tophat-2.2.1 lib/tophat/robots.rb