Skip to content

Sub-path deployments: the sitemap lists the site root twice (with and without a trailing slash) #121

Description

@ramonmalcolm10

On a sub-path deployment the sitemap lists the site root twice — once with a
trailing slash and once without — so it carries one more entry than the site
has pages.

Everything else about base is correct on 0.13.1: I re-ran the checks from
#105 after #112/#114 and all 481 root-relative URLs across a 14-page build
carry the base, favicon and shiki.css included. This is the last piece of that
family I can still see.

Reproduction

create-nimbus-docs scaffold, nimbus-docs 0.13.1, with a sub-path added:

// astro.config.ts
export default defineConfig({
  site: "https://example.github.io",
  base: "/my-project",
  // …
});

astro build, then look at dist/sitemap-0.xml:

https://example.github.io/my-project      ← no trailing slash
https://example.github.io/my-project/
https://example.github.io/my-project/getting-started/
…

Only one root page exists (dist/index.html), and the build reports 15 pages
for 14 routes plus 404.html, which sitemaps exclude — so 14 entries are
expected and 15 are emitted. The extra one is the bare base.

It needs base

Same scaffold with base removed emits the root exactly once:

https://example.com/
https://example.com/getting-started/
…

Not a site misconfiguration

The integration bridges nimbusConfig.site into Astro's top-level site, so I
tried it both ways on a project site — site as the bare origin
(https://example.github.io) and as the origin plus sub-path
(https://example.github.io/my-project). Both emit 15 entries, and the
canonical tag is correct in both (https://example.github.io/my-project/), so
the duplicate does not appear to come from how site and base are split.

Impact

Minor: the canonical tags point at the trailing-slash form, so crawlers should
consolidate the two. But the sitemap is the thing that asks them to crawl both,
and a sitemap that disagrees with its own canonicals is an odd signal to send.
It also makes entry counts a slightly unreliable check when validating a build.

Happy to test a patch — I have a sub-path site set up and the before/after
checks scripted.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions