Class: HTML::Pipeline::NoFollowLinksFilter
- Defined in:
- lib/html/pipeline/no_follow_links_filter.rb
Overview
Add rel=“nofollow” to <a> links if enabled in the context to avoid giving SEO juice to potential spam links.
Instance Attribute Summary
Attributes inherited from Filter
Instance Method Summary collapse
Methods inherited from Filter
#base_url, call, #current_user, #doc, #has_ancestor?, #html, #initialize, #needs, #parse_html, #repository, to_document, to_html, #validate
Constructor Details
This class inherits a constructor from HTML::Pipeline::Filter
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 |
# 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 |