Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@astrojs/sitemap 1.3.0 no longer builds dynamic routes into sitemap #7015

Closed
1 task
mattstein opened this issue May 5, 2023 · 1 comment · Fixed by #7029
Closed
1 task

@astrojs/sitemap 1.3.0 no longer builds dynamic routes into sitemap #7015

mattstein opened this issue May 5, 2023 · 1 comment · Fixed by #7029
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@mattstein
Copy link
Contributor

What version of astro are you using?

2.4.2

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Mac

What browser are you using?

Safari

Describe the Bug

Upgrading @astrojs/sitemap from 1.2.2 to 1.3.0 drops all dynamic routes that had previously appeared in my sitemaps. Previously any routes defined by getStaticPaths() would appear as full URLs in sitemap-0.xml, and now they’re gone.

If I followed #6534 correctly, there shouldn’t be any change in functionality for non-SSR sites or any required config updates.

You can observe this in the blog starter without making any changes:

<?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/about/</loc>
    </url>
    <url>
        <loc>https://example.com/blog/</loc>
    </url>
    <url>
        <loc>https://example.com/rss.xml/</loc>
    </url>
</urlset>

Pin the sitemap package at 1.2.2, install and build and the blog post pages will appear as expected:

<?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/about/</loc>
    </url>
    <url>
        <loc>https://example.com/blog/</loc>
    </url>
    <url>
        <loc>https://example.com/blog/first-post/</loc>
    </url>
    <url>
        <loc>https://example.com/blog/markdown-style-guide/</loc>
    </url>
    <url>
        <loc>https://example.com/blog/second-post/</loc>
    </url>
    <url>
        <loc>https://example.com/blog/third-post/</loc>
    </url>
    <url>
        <loc>https://example.com/blog/using-mdx/</loc>
    </url>
</urlset>

Link to Minimal Reproducible Example

https://stackblitz.com/github/withastro/astro/tree/latest/examples/blog?file=README.md

Participation

  • I am willing to submit a pull request for this issue.
@maddsua
Copy link

maddsua commented May 7, 2023

Actually it makes my project to completely fail the build:

...
Completed in 273ms.

node:events:491
      throw er; // Unhandled 'error' event
      ^

EmptySitemap: You ended the stream without writing anything.
Emitted 'error' event on SitemapStream instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.12.1

If I remove the 404.astro from the project, the sitemap plugin outputs No pages found!. But it's presence causes the plugin to fail spectacularly.

Rolling back to sitemap v1.2.2 does not help as long as Astro stays at v2.4.2. Worked fine with Astro v2.3.1 and sitemap v1.2.2 before

upd: Oh, it's withastro/compiler#786 strikes back
upd2: Now it doesn't make any sense... You tinker with some stuff - it starts to work, then it breaks again

@ematipico ematipico added the - P4: important Violate documented behavior or significantly impacts performance (priority) label May 8, 2023
@ematipico ematipico self-assigned this May 8, 2023
saintfish added a commit to cwts-edu/cwts-web that referenced this issue May 18, 2023
saintfish added a commit to cwts-edu/cwts-web that referenced this issue May 22, 2023
saintfish added a commit to cwts-edu/cwts-web that referenced this issue May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
3 participants