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`.
This commit is contained in:
Roman Rizzi
2022-04-12 10:33:59 -03:00
committed by GitHub
parent 9c33f6de05
commit 6f76a12e0a
14 changed files with 576 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class CreateSitemapsTable < ActiveRecord::Migration[6.1]
def change
create_table :sitemaps, if_not_exists: true do |t|
t.string :name, null: false
t.datetime :last_posted_at, null: false
t.boolean :enabled, null: false, default: true
end
add_index :sitemaps, :name, unique: true, if_not_exists: true
end
end