Doing this, rendered the default “tag” and “category” taxonomies which I do not use in my theme. So I looked up how to remove them and added this to my config file:
tag = ""
category = ""
However, this configuration screws up my sitemap.xml which now renders like this:
If I remove the configuration, the sitemap is generated normally but the tag and category blank page indexes are generated also, which I do not want.
This is actually working for me now. Adding this to the config file doesn’t render the taxonomy pages and the sitemap is generated correctly once again:
I cannot reproduce your issue. I have turned off taxonomies the same way [quote=“Toma, post:1, topic:7245”]
[ taxonomies ]
tag = ""
category = “”
[/quote]
The sitemap renders as it should with the latest Hugo version.
Are you using a template for your sitemap.xml? If yes, then it’s very likely that there is something included in that template that’s causing this.
Yes I am using a slightly different sitemap template than the default to block out my “gallery” section from the sitemap. That could very well be the issue. Here is the template:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range (where .Data.Pages "Section" "!=" "gallery") }}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
<xhtml:link
rel="alternate"
hreflang="{{ .Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
</url>
{{ end }}
</urlset>
Well… I have replaced my sitemap.xml with yours in one of my test projects and only changed the name of the section in the range function (to exclude a section that matches my site structure) and over here the xml renders correctly and the taxonomies pages are excluded like they should be with: [quote=“Toma, post:1, topic:7245”]
[ taxonomies ]
tag = ""
category = “”
[/quote]
@Toma Sorry I made a mistake before while testing.
In my test site I am not using categories at all. So in my config I had only turned off tags. And the sitemap was rendering as it should.
As soon as I included category = "" in the config I got the result you mentioned.
This seems like a bug. Maybe @bep knows something.
Don’t know if it should be reported on Github, since disableKinds = ["taxonomy", "taxonomyTerm"] works.
EDIT
In another project I am using a modified older version of the Hugo sitemap template prior to the modifications for version 0.9 of the Sitemap Protocol with Google’s hreflang attributes.
In this case category = "" in the config does not break the sitemap.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ range .Data.Pages }}{{ if not .Params.hidden }}
<url>
<loc>{{ .Permalink }}</loc>
{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}
</url>
{{ end }}{{ end }}
</urlset>