Module: Pope
- Defined in:
- lib/pope.rb,
lib/pope/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Class Method Details
.canonize(input_url, typhoeus_options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/pope.rb', line 7 def self.canonize input_url, = {} .reverse_merge! follow_redirects: true # Fetch document response = Typhoeus::Request.get input_url, doc = Nokogiri::HTML(response.body) # Parse out canonical URL tag if present ( = doc.css('[rel="canonical"]').first) && .attr('href') end |