Skip to content

sitemap URLs missing extensions when build.format = file #15526

@borisovg

Description

@borisovg

Astro Info

Astro                    v5.17.2
Vite                     v6.4.1
Node                     v24.13.1
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/sitemap (v3.7.0)

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

No response

Describe the Bug

Given that astro.config.mjs contains build: { format: "file" } and sitemap integration is used the sitemap has incorrect URL which is missing the file extension.

For example:

$ find dist/
dist/
dist/test.html
dist/sitemap-index.xml
dist/index.html
dist/favicon.ico
dist/favicon.svg
dist/sitemap-0.xml

$ cat dist/sitemap-0.xml 
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"><url><loc>https://example.com</loc></url><url><loc>https://example.com/test</loc></url></urlset>

https://example.com/test in the wrong URL

Related: #11575

What's the expected result?

I would expect the sitemap URL to include .html extension (e.g. https://example.com/test.html in my example above).

Link to Minimal Reproducible Example

https://stackblitz.com/github-enn5c2ht

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P2: has workaroundAn edge case that only affects very specific usage, but has a trivial workaround (priority)pkg: integrationRelated to any renderer integration (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions