28. August 2024 1 min read
Do not display page in sitemap in Hugo in Markdown
You will need a newer version of hugo (newer than 0.126.0) for this to work, but it is possible to prevent or disable the page to display in Sitemap when using hugo awesomest static-site generator. This requires no changes or additions to your or theme's layout file (provided your theme does not use a special one), but you simply need to add following lines to your frontmatter in Markdown:
---
sitemap:
disable: true
---
Now that you know how to hide page in an automatically generated Sitemap.xml when using hugo awesomest static-site generator, keep in mind that page should also not have any tags, as those are rendered and usually added by the theme, which then produces a link to page you wanted to hide. Also any of the main menus can automatically point to the page that you want to keep at least a bit more private (although we know that nothing published online is actually private) should be adjusted - which is theme dependent. I hope this helps your usecase.