Sha256: 9fe14f026ef0510ee3abbfb714315eaa87637f482503d4515f3655402bdb993c

Contents?: true

Size: 389 Bytes

Versions: 1

Compression:

Stored size: 389 Bytes

Contents

module HTML
  class Pipeline

    # Add rel="nofollow" to <a> links if enabled in the context to avoid giving
    # SEO juice to potential spam links.
    class NoFollowLinksFilter < Filter

      def call
        return doc unless context[:nofollow]

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

    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
html-pipeline-linuxfr-0.15.7 lib/html/pipeline/no_follow_links_filter.rb