I wanted to use Sitemap.Disable to exclude a page from the sitemap. I used it like this:
---
title: 400 Bad request
Sitemap:
Disable: true
---
This didn’t have any affect. I am not sure if I am using it wrong or this is a bug.
I fixed it by adapting the sitemap.xml:4:
{{ range where .Pages "Sitemap.Disable" "ne" true }}
to
{{ range where .Pages ".Params.sitemapExclude" "ne" true }}
Basically introducing a new front matter variable to achieve the same.
Did I find a bug and should I create an issue/pull request or am I using it wrongly?
sitemap:
changefreq: weekly
disable: true
priority: 0.8
from the docs… case sensitivity is important here. use small characters in the markdown. Use title cased in your layout files.
I just tried using lowercase, it doesn’t work either. Are you sure btw that case sensitivity matter. I was under the impression that it doesn’t matter here
Which version of Hugo are you running? The disable
field was added in v0.125.0.
The keys are case-insensitive, but you should get into the habit of using them as shown in the documentation .
We have a thorough integration test for this functionality, so I doubt you’ve found a bug:
https://github.com/gohugoio/hugo/blob/28f621d4a73ca7e97e23b33cbf3780ddab188d24/tpl/tplimpl/tplimpl_integration_test.go#L272-L321
Ah yes, you are absolutely right. I am using the ubuntu latest version, and this one is a little bit outdated. Sorry for the confusion…
system
Closed
September 15, 2024, 6:44am
6
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.