From 34c3df78d967e6dd9c93881c3cc5db8f7f679b7b Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 12 Jan 2020 22:58:22 -0600 Subject: [PATCH] /sitemap.xml: exclude posts that aren't visible. --- app/controllers/static_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index 63d7f13ce..fc151ebd7 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -19,6 +19,7 @@ class StaticController < ApplicationController def sitemap @popular_search_service = PopularSearchService.new(Date.yesterday) @posts = Post.where("created_at > ?", 1.week.ago).order(score: :desc).limit(200) + @posts = @posts.select(&:visible?) render layout: false end end