From 12d3f94e3c8da1ac4a000d52cc3066b5652f20a4 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 18 May 2017 15:02:21 +0100 Subject: [PATCH 1/1] Play a bit of whack-an-seo-mole --- lib/rich_text.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/rich_text.rb b/lib/rich_text.rb index 83eb23540..db296967b 100644 --- a/lib/rich_text.rb +++ b/lib/rich_text.rb @@ -1,4 +1,8 @@ module RichText + SPAMMY_PHRASES = [ + "Business Description:", "Additional Keywords:" + ].freeze + def self.new(format, text) case format when "html" then HTML.new(text || "") @@ -36,7 +40,13 @@ module RichText link_proportion = link_size.to_f / doc.content.length.to_f end - [link_proportion - 0.2, 0.0].max * 200 + link_count * 40 + spammy_phrases = SPAMMY_PHRASES.count do |phrase| + doc.content.include?(phrase) + end + + [link_proportion - 0.2, 0.0].max * 200 + + link_count * 40 + + spammy_phrases * 40 end protected -- 2.39.5