Skip to content

Commit bef2f41

Browse files
authored
Merge pull request linuxfrorg#297 from Trim/async-robot-index-follow
application_helper: if content has been recently published, set the robot index/follow threshold a bit higher than 0
2 parents 7efdc74 + e6ce53a commit bef2f41

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/helpers/application_helper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ def meta_for(content)
2121
@keywords = content.node.popular_tags.map &:name
2222
@description = content.title
2323
@dont_index = true if content.node.score < 0
24+
published_at = content.node.try(:created_at) || DateTime.now()
25+
# For all content recently published, ask robots to not index it if
26+
# a minimum score is not reached during the first 24 hours.
27+
# The threshold is set to the one used by moderated News, so the moderated
28+
# content can still be fastly indexed by robots.
29+
@dont_index ||= true if published_at > DateTime.now() - 24.hour && content.node.score <= News.accept_threshold
2430
end
2531

2632
end

0 commit comments

Comments
 (0)