Skip to content

@astrojs/sitemap not included in the static output with SSR on Vercel adapter #12437

@Javiervinus

Description

@Javiervinus

Astro Info

Astro                    v5.0.0-beta.8
Node                     v20.11.1
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/vercel
Integrations             @astrojs/sitemap
                         @astrojs/tailwind
                         @astrojs/react
                         astro-icon
                         @astrojs/partytown

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

In an Astro project using the @astrojs/sitemap plugin and deploying with the Vercel adapter (@astrojs/vercel in SSR mode), the sitemap.xml file does not appear in the final static output on Vercel.

Issue Details

  • The issue is not related to missing SSR dynamic routes in the sitemap. In fact, I am using the customPages option in @astrojs/sitemap to handle dynamic routes manually, and this part works as expected.
  • The main problem is that the @astrojs/sitemap plugin generates the sitemap.xml after Vercel has already finalized the static assets output.
  • During the local build, the sitemap file is created in the dist/client folder only after Vercel finishes packaging the static content, which causes the sitemap file to be excluded from the deployed static files.

Project Context

  • The project contains a mix of static and SSR pages.
  • The sitemap is intended to index both types of pages, but even the static pages do not appear in the final build on Vercel due to the timing of the sitemap generation.

What's the expected result?

The @astrojs/sitemap plugin should generate the sitemap.xml and any other sitemap files before the Vercel adapter finalizes the build. This way, the sitemap files can be included in the output deployed to Vercel.

Link to Minimal Reproducible Example

none

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs reproIssue needs a reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions