Netlify Sitemap Plugin generates only for /

I have deployed my site on Netlify with installing Sitemap Plugin, which works okay, but my sitemap is only for my index page.

What do I have to do for sitemap understanding all my routes ?

This is the sitemap for preview:
https://www.theomnified.com/sitemap.xml

For correct SEO I need to map each of my routes. I am trying to avoid installing react plugins, since Netlify has this option, I would like to use it. Is there a way how to achieve it ?

Thank you!

Hi @Petra

Is your site a single-page app? If so, you might need to look at Prerendering as outlined in Prerendering | Netlify Docs

The Sitemap plugin, as far as I can see, SPA’s are not supported, even with pre-rendering.

Sitemaps are not generated by “clicking through” your website, aka indexing it. It’s generated solely based on the files in the published folder, which for a SPA would usually only be a index.html, which is why it’s all you see.

If your structure looks something like this

- build
 -- index.html
 -- about.html
 -- blog
  -- welcome.html
  -- my-awesome-site.html
  -- how-and-why.html

Then the sitemap plugin works; otherwise it’s completely useless.

I wonder if @verythorough could add to this?

In what file I should put this @freddy ? Seems like a solution.

It depends on where your “public” files are located, if you’re using Vue, it would usually be a folder called public.

If you use Vue or React, then there are better ways, modules specific to those frameworks that generates a sitemap based on your router during the build. For a site with dynamic data (Data coming from an API) and routes, then it can be quite a pain, but if your routes a pretty much static, it’s a nice solution.

Edit: It’s not “One file” either, it’s basically one file for every page you have. Imagine that you made a website the good old 90’s way, and had a seperate file for every single page you have. That’s what you need for Netlify’s plugin to work, return to the 90’s :stuck_out_tongue:

If you are using React, as @freddy mentioned there are modules for creating a sitemap during build.

One sitemap generator for React is

Or you might go down the path of static pre-rendering using something like

There are likely others.

1 Like