Module: CanonicalDude::ActionViewMethods

Defined in:
lib/canonical_dude/action_view_methods.rb

Instance Method Summary collapse

Instance Method Details

tag to include within your HTML header, e.g.:

<%= canonical_link_tag %>


6
7
8
9
# File 'lib/canonical_dude/action_view_methods.rb', line 6

def canonical_link_tag( url_for_options = nil )
  url = canonical_url_from( url_for_options || @_canonical_url_for_options || request.url )
  tag( :link, :rel => 'canonical', :href => url ) if url # custom url methods may sometimes return nil --R
end

returns true if canonical_url has been explicitly set

Returns:

  • (Boolean)


12
13
14
# File 'lib/canonical_dude/action_view_methods.rb', line 12

def canonical_link_tag?
  !!@_canonical_url_for_options
end