Skip to content

Commit

Permalink
Include the absolute URL to the sitemap in the robots.txt file (#633)
Browse files Browse the repository at this point in the history
In the robots.txt file, the value of the sitemap field is a relative
URL.
This should be changed to an absolute URL.
See protocol: https://sitemaps.org/protocol.html#submit_robots

For example, in the Google search console, this error message appears
when it's a relative url:

> "Invalid sitemap URL" incomprehensible syntax

I think it would be interesting to have a default sitemap field in the
right format using `root_url`.
  • Loading branch information
FBruynbroeck committed May 18, 2024
1 parent 7bb842b commit f57cd69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion coderedcms/templates/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{% load wagtailcore_tags %}
{% wagtail_site as site %}
User-agent: *
Disallow: /admin/

Expand All @@ -7,4 +9,4 @@ Disallow: /django-admin/
User-agent: *
Allow: /

Sitemap: /sitemap.xml
Sitemap: {{ site.root_url }}/sitemap.xml

0 comments on commit f57cd69

Please sign in to comment.