Last active
December 21, 2015 04:09
-
-
Save stuarthannig/6247443 to your computer and use it in GitHub Desktop.
Revisions
-
stuarthannig renamed this gist
Aug 16, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
stuarthannig created this gist
Aug 16, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ # http://kellishaver.tumblr.com/post/54922678930/quick-tip-canonical-urls # Building a site that handles link submissions? Check submitted links for a canonical URL tag to avoid duplicates. # Similarly, if you’re a content creator and you’re not using the canonical URL tag, you should be! def canonical(url) begin page = Nokogiri::HTML(open(url)) page.css("link[rel=canonical]")[0]["href"] rescue url end end