Files
forum/app/jobs/scheduled/regenerate_sitemaps.rb
Roman RizziandGitHub db467252d4 FEATURE: Let sites add a sitemap.xml file. (#16357)
* FEATURE: Let sites add a sitemap.xml file.

This PR adds the same features discourse-sitemap provides to core. Sitemaps are only added to the robots.txt file if the `enable_sitemap` setting is enabled and `login_required` disabled.

After merging discourse/discourse-sitemap#34, this change will take priority over the sitemap plugin because it will disable itself. We're also using the same sitemaps table, so our migration won't try to create it
again using `if_not_exists: true`.
2022-04-12 10:33:59 -03:00

12 lines
214 B
Ruby

# frozen_string_literal: true
module Jobs
class RegenerateSitemaps < ::Jobs::Scheduled
every 1.hour
def execute(_args)
Sitemap.regenerate_sitemaps if SiteSetting.enable_sitemap?
end
end
end