Skip to content

[Feature?] Generate sitemap.xml files when building the app #423

Closed as not planned

Description

@fbritoferreira

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

Activity

  1. kasvith commented on Nov 11, 2022

    @kasvith

    Cant we use a vite plugin here?

  2. fbritoferreira commented on Jan 20, 2023

    @fbritoferreira
    Author

    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

  3. ryansolid commented on Dec 18, 2023

    @ryansolid
    Member

    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.

  4. fbritoferreira commented on Dec 21, 2023

    @fbritoferreira
    Author

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

  5. edelms commented on Apr 23, 2024

    @edelms

    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

  6. changed the title [-]Generate sitemap.xml files when building the app[/-] [+][Feature?] Generate sitemap.xml files when building the app[/+] on Jul 26, 2026
  7. brenelz commented on Sep 11, 2026

    @brenelz
    Contributor
  8. lxsmnsyc commented on Oct 14, 2026

    @lxsmnsyc
    Member

    Closing, since sitemap generation does not need to live in SolidStart itself:

    • SolidStart 2.x: use the prerender-crawler Vite plugin with its sitemap() integration, as brenelz mentioned above. It writes sitemap.xml from the pages the crawl actually renders, with dynamic segments expanded, and leaves out redirects and noindex pages.
    • SolidStart 1.x: add a sitemap.xml.ts API route that returns the XML, and list it under server.prerender.routes in app.config.ts so it is generated at build time. edelms's config and route above show the full setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions