Module: TopHat::RobotsHelper

Defined in:
lib/tophat/robots.rb

Constant Summary collapse

DEFAULT_DESCRIPTOR =
'robots'

Instance Method Summary collapse

Instance Method Details

#canonical(path = nil) ⇒ Object



23
24
25
# File 'lib/tophat/robots.rb', line 23

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

#nofollow(descriptor = nil, content = 'nofollow') ⇒ Object



10
11
12
# File 'lib/tophat/robots.rb', line 10

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

#noindex(descriptor = nil, content = 'noindex') ⇒ Object



6
7
8
# File 'lib/tophat/robots.rb', line 6

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

#robot_tag(descriptor = nil, content) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/tophat/robots.rb', line 14

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