Skip to content

Commit

Permalink
Changed default to output nothing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bleigh committed Feb 13, 2009
1 parent f8e3672 commit 55c9d30
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.markdown
Expand Up @@ -30,7 +30,7 @@ The plugin is very simple to use and consists of a controller method and a helpe
...
</html>

This will automatically insert a canonical URL tag into every page of your site, defaulting to the request's current URL (we assume that the current URL is the canonical URL for any page where it is not specified). Then you can set canonical URLs in the controller as follows:
This will automatically insert a canonical URL tag into every page of your site, defaulting to the request's current URL (it will not output anything when you have not specified a canonical URL through the controller or explicitly through the link tag). Then you can set canonical URLs in the controller as follows:

class BlogController < ApplicationController
def show
Expand Down
1 change: 1 addition & 0 deletions lib/canonical_url.rb
Expand Up @@ -12,6 +12,7 @@ def canonical_url(url_for_options = {})

module Helpers
def canonical_link_tag(url = nil)
return '' unless url || @canonical_url
tag('link', :rel => 'canonical', :href => url || @canonical_url || request.url)
end
end
Expand Down

0 comments on commit 55c9d30

Please sign in to comment.