DEV Community

Discussion on: SvelteKit Blog SEO: Climb the Search Results Page

Collapse
 
endymion1818 profile image
Ben Read

This looks awesome! Does it include a way of generating an xml sitemap? It’s the one thing I’ve had issues with before.

Collapse
 
askrodney profile image
Rodney Lab

Thanks Ben! You're right an xml sitemap is great for SEO. It is on my list of things to add next, followed by an rss feed. Will let you when I have it sorted.

Collapse
 
askrodney profile image
Rodney Lab

It does now! Would love feedback if you have time to test it out. I included an endpoint to serve the sitemap for SSR sites and also a script to generate it for static sites.

  • If you want to go SSR, just delete the (dummy) sitemap at static/sitemap.xml and it should just work 🤞🏽 (endpoint file at routes/sitemap.xml.js)
  • If you want to go static, generate the sitemap as a oneoff by running pnpm generate:sitemap or to generate pre every build update build script in package.json to something like npm run generate:sitemap && svelte-kit build.
Collapse
 
endymion1818 profile image
Ben Read

Aw fab! I definitely will check this out! Thank you for responding!