module SeoReport::Extractions::Head

Public Instance Methods

extract_head(doc) click to toggle source
# File lib/seo_report/extractions/head.rb, line 4
def extract_head(doc)
  title = doc.xpath('//head/title').text
  description = doc.xpath('//head/meta[@name="description"]').
                map { |node| node.attr("content") }
  title = nil if title.empty?
  {
    title: title,
    description: unarray(description),
  }
end