class HTML::Pipeline::NoFollowLinksFilter

Add rel=“nofollow” to <a> links if enabled in the context to avoid giving SEO juice to potential spam links.

Public Instance Methods

call() click to toggle source
# File lib/html/pipeline/no_follow_links_filter.rb, line 8
def call
  return doc unless context[:nofollow]

  doc.css("a[href]").each do |element|
    element['rel'] = 'nofollow'
  end
  doc
end