Finalize generated sitemap (#1466)

* Add sitemap generation

* Modify sitemap details
This commit is contained in:
Ben Halpern 2019-01-05 20:40:19 -05:00 committed by GitHub
parent 98b68fa15c
commit a0e4f01020
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -16,17 +16,17 @@ SitemapGenerator::Sitemap.default_host = "#{ApplicationConfig['APP_PROTOCOL']}#{
SitemapGenerator::Sitemap.create do
Article.where(published: true).
where("reactions_count > ? OR featured = ?", 20, true).
where("score > ? OR featured = ?", 13, true).
where(published: true).
order("last_comment_at DESC").limit(1000).find_each do |article|
add article.path, lastmod: article.last_comment_at
order("last_comment_at DESC").limit(25000).find_each do |article|
add article.path, lastmod: article.last_comment_at, changefreq: "daily"
end
User.order("comments_count DESC").where("updated_at > ?", 5.days.ago).limit(250).find_each do |user|
User.order("comments_count DESC").where("updated_at > ?", 5.days.ago).limit(8000).find_each do |user|
add "/#{user.username}", changefreq: "daily"
end
Tag.order("hotness_score DESC").limit(100).find_each do |tag|
Tag.order("hotness_score DESC").limit(250).find_each do |tag|
add "/t/#{tag.name}", changefreq: "daily"
end
end

View file

@ -3,3 +3,5 @@
# To ban all spiders from the entire site uncomment the next two lines:
# User-agent: *
# Disallow: /
Sitemap: https://thepracticaldev.s3.amazonaws.com/sitemaps/sitemap.xml.gz