solidjs / solid-start

SolidStart, the Solid app framework
https://start.solidjs.com
MIT License
4.94k stars 371 forks source link

Generate sitemap.xml files when building the app #423

Open fbritoferreira opened 1 year ago

fbritoferreira commented 1 year ago

We should be able to generate the sitemap.xml file as part of the build process.

Fresh-seo does something similar for the fresh framework https://github.com/xstevenyung/fresh-seo

But this could be integrated into the app maybe as I opt in if people are only building a SPA

kasvith commented 1 year ago

Cant we use a vite plugin here?

fbritoferreira commented 1 year ago

Tried using https://github.com/jbaubree/vite-plugin-sitemap but it seems like it wont work out of the box for the sitemap config, we need a way for it to undestand the routes in solid

ryansolid commented 6 months ago

Hmm this is interesting because we support a combination of file system and runtime routes. I'm not sure if we can get that information easily at build time.

fbritoferreira commented 6 months ago

@ryansolid For non dynamic routes we could possible get it at build time, for dynamic routes I guess we could provide some kind of pre-defined to use but there isn't much it can be done?

edelms commented 2 months ago

For my current project it was quite easy to generate the sitemap.xml at build time. My site is static only, route prerendering could work differently for other nitro presets or dynamic routes.

@ryansolid Something like this could be added to the docs or a starter template?

Relevant changes are the prerender config and the sitemap.xml.ts route. https://github.com/edelms/spfx-x/blob/main/docs/app.config.ts https://github.com/edelms/spfx-x/blob/main/docs/src/routes/sitemap.xml.ts