I'm creating a sitemap for my django project using the built-in site framework.
I have a model with get_absolute_url
method using reverse
by url name.
By default, without any custom/configuration, I got this kind of sitemap:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/</loc>
<lastmod>2020-07-29</lastmod>
<changefreq>hourly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://example.com/subdomain/</loc>
<lastmod>2020-07-29</lastmod>
<changefreq>hourly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
Well, this is where I started shruging.
Quoting from django's sitemap documentation:
location
Optional. Either a method or attribute.
If it’s a method, it should return the absolute path for a given object as returned by items().
If it’s an attribute, its value should be a string representing an absolute path to use for every object returned by items().
In both cases, “absolute path” means a URL that doesn’t include the protocol or domain. Examples:
Good: '/foo/bar/'
Bad: 'example.com/foo/bar/'
Bad: 'https://example.com/foo/bar/'
But as you can see from the example above, by default the protocol and the domain are both included inside loc
tag on the sitemap.xml.
Quoting from the Sitemap Documentation that are contradicts with each other:
<loc> required
URL of the page. This URL must begin with the protocol (such as http) and end with a trailing slash, if your web server requires it. This value must be less than 2,048 characters.
So, assuming I'm doing SEO and trying to raise my site rank on the google search with proper sitemap, what should I pick between both styles ?