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



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

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

#nofollow(descriptor = nil) ⇒ Object



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

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

#noindex(descriptor = nil) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/tophat/robots.rb', line 6

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