solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

Generate sitemap.xml files when building the app

Open fbritoferreira opened this issue 1 year ago • 5 comments

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

fbritoferreira avatar Nov 11 '22 14:11 fbritoferreira

Cant we use a vite plugin here?

kasvith avatar Nov 11 '22 17:11 kasvith

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

fbritoferreira avatar Jan 20 '23 11:01 fbritoferreira

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.

ryansolid avatar Dec 18 '23 21:12 ryansolid

@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?

fbritoferreira avatar Dec 21 '23 21:12 fbritoferreira

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

edelms avatar Apr 23 '24 20:04 edelms