mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 00:43:24 +08:00
6f76a12e0a
* 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`.
26 lines
1.2 KiB
Plaintext
26 lines
1.2 KiB
Plaintext
<?xml version="1.0" encoding="UTF-8"?>
|
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
|
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
|
|
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
|
|
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
|
|
http://www.google.com/schemas/sitemap-news/0.9
|
|
http://www.google.com/schemas/sitemap-news/0.9/sitemap-news.xsd
|
|
http://www.google.com/schemas/sitemap-image/1.1
|
|
http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd">
|
|
<% @topics.each do |(id, title, slug, created_at)| %>
|
|
<url>
|
|
<loc><%= build_sitemap_topic_url(slug, id) %></loc>
|
|
<news:news>
|
|
<news:publication>
|
|
<news:name><%= SiteSetting.title %></news:name>
|
|
<news:language><%= @locale %></news:language>
|
|
</news:publication>
|
|
<news:publication_date><%= created_at.xmlschema %></news:publication_date>
|
|
<news:title><%= title %></news:title>
|
|
</news:news>
|
|
</url>
|
|
<% end %>
|
|
</urlset>
|