Sitemap discrepancy with Pretty URLs

Hi All,

The Sitemap plugin is great but lacks the trailing slash to match the enabled Pretty URL setting.

For example, I have Pretty URLs enabled, which adds a trailing slash at the end of the URL. However, the sitemap generated by the Netlify plugin does not have the trailing slash.

I read the pretty URL guidelines here, and here, but cannot find a fix.

I redeployed my site by clearing the cache to regenerate the sitemap, but the sitemap still does not show a trailing slash. Then, I built the sitemap with an external tool which successfully included the trailing URL.

Examples:
https://www.vanas.fr/sitemap.xml

Netlify plugin generates this URL (Does not have the trailing slash)
https://www.vanas.fr/horaires-de-cours

External sitemap generates this URL (successfully ads the trailing slash)
https://www.vanas.fr/horaires-de-cours/

The GitHub repository for the Sitemap plugin does show in the Javascript that considers the pretty URL.

I want to keep pretty URLs enabled, so please let me know if I am missing something. Perhaps, there is a setting or step I haven’t followed.

Thank you for your time.

The Netlify URL is:
vanas-france.netlify.app

The setting can be enabled: netlify-labs/netlify-plugin-sitemap: Automatically Generate sitemaps on build (github.com)

1 Like

Hi @hrishikesh,

Thanks for responding.

Sitemaps and Pretty URLs were enabled. Still, the sitemap.xml file does not generate a trailing slash at the end of the URL. As a result, there are redirects reported.

I did a combination of tests like disabling pretty URLs and the sitemap plugins but the / at the end is not present.

Thank you for any other ideas you may have.


Screenshot 2023-07-23 at 7.54.39 AM

Did you check the link I provided? It sends you to the documentation of the plugin which ha some configuration options. It has nothing to do with any of the screenshots you’ve provided.

Hi @hrishikesh

I hope you are well and thank you for responding.

I did review the link you attached but I can’t see where I edit the settings. The pretty URLs have only one button “configure,” yet there is nothing else but a check mark.

How do I access the configuration settings your link shows?

Thank you for your time.

That’s done in netlify.toml. It’s all explained in the readme. Please refer to that.

Hi @hrishikesh,

Thank you for responding. To ensure we write about the same issue.

Can you tell what is the expected behavior?

a)The sitemap plugin adds the trailing slash when pretty URLs are on (and removes it when it’s off).
b)After enabling Pretty URLs, I need to config the sitemap manually to add the trailing slash.

Which one is the expected behavior?

Thank you for your time.

Best,

a) is incorrect
b) is correct

Ah, that explains it. Thank you @hrishikesh

Glad our team could be of help.

I had the same issue with the Sitemap plugin when enabled via the Netlify UI. Just to wrap up the solution proposed in this thread:

  1. Disable the Sitemap plugin in Site configuration > Build & deploy > Build plugins.

  2. Perform file-based installation of the Sitemap plugin, which will allow for advanced configuration.

  3. Further configure the Sitemap plugin in netlify.toml so missing trailing slashes are appended to pretty URL.