Sitemap - How to include sections?

Hi, I’m looking to include sections of my main page in the sitemap because right now, none of them are being registered with the standard template. So basically I would like to include something like http://localhost:1313/#about or http://localhost:1313/#services. I’m using the Meghna theme. Has anyone tried to do that? Thanks a lot.

Are you referring to a sitemap.xml file? If so, that’s not how sitemaps work. They only include actual webpages. If you have a single page with sections, that’s still just a single page. A con of the design you’ve chosen.

If you’re referring to a different, human-readable sitemap, I don’t think you can do this easily with Hugo but you can use JavaScript to generate it.

Hi, thanks for your reply. Yes I was referring to sitemap.xml. I read that I could make the sections behave like pages in the following article:
If I put that in place, would my sections be included in the sitemap.xml?
Could a human readable sitemap be advantageous when it comes to SEO?
Thank a lot for your help.

The article you are linking to refers to something different than what you’re talking about. In that article, it’s doing dynamic loading with a completely different URL. Your example used anchors (#like-this) which is still a single page.

Regardless of how you construct your website, a sitemap should include the URL of every webpage you have. Anything after a hash (#) or question mark is the end of the URL.

For example,

The listing above is only 3 pages. So the sitemap for it would only include:

This is good. The pages will be indexed. You don’t want to have the redundant links in the sitemap because they are the same page and Google might penalize you for redundant content.

A human-readable sitemap may be beneficial, but only when your site is large enough for users to actually need it.


Thank you so much for this detailed answer. Very much appreciated.

1 Like