-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Sitemap: support SSR routes #6534
Conversation
🦋 Changeset detectedLatest commit: 4e00db6 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
1b73cea
to
ec7aac0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need a build:start
hook with custom logic for this! build:done
probably has most of what you need already, and if there's anything missing we can work on exposing it.
packages/integrations/sitemap/src/utils/is-route-prerendered.ts
Outdated
Show resolved
Hide resolved
6b77de2
to
9d2af5c
Compare
Thanks for the insights, @natemoo-re . I refactored accordingly. |
I’d guess this makes it impossible for us to support these dynamic SSR routes in the sitemap. |
Oh 🤯. Thanks a lot for this clarification @delucis The ideal scenario would be (1) for the developer to use In this case I'll just get CI to pass 😊 |
9d2af5c
to
c289460
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good! Happy to help debug CI failures if you're stuck, just let me know.
Thanks, @natemoo-re I'm afraid I'll need your input on this one.
But the generator does not take into consideration At this point I wanted to stop and ask you: is it desirable to patch the /**
* If `addTrailingSlash` is 'always'
* or `buildFormat` is 'directory' and `addTrailingSlash` is not "never"
*/
const shouldAddTrailingSlash =
addTrailingSlash === 'always' ||
(buildFormat === 'directory' && addTrailingSlash !== 'never');
let trailing: '/' | '' = '';
if (shouldAddTrailingSlash && segments.length) {
trailing = '/';
} but this breaks 1 test: astro-root-pagination-spread. Additionally, So, what do you think I should do? I just would like to have context if |
54ee3d3
to
aa4efae
Compare
8a5a828
to
33dd8ca
Compare
@atilafassina sorry for not getting back to you. routeData is not "normalized" to take into account trailing slash config, you are right on that. We do that at the "end" of things, such as when static files are generated. So I think you are right to do it in the integration itself. Let me know when this is ready for another review. |
f625c1d
to
45a8d5c
Compare
pinging both @ElianCodes and @matthewp since both of y'all showed interest in it. I had some weird situation with corrupted |
Awesome! Thanks @atilafassina! I will take a look at it when I'm back from Copenhagen, Denmark! |
55cdbfa
to
b86602a
Compare
b86602a
to
979300c
Compare
@atilafassina Saw the new commits, is this ready to go? |
@matthewp , Yes. I'd say so. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome @atilafassina! Before this is merged, are there docs we need to adjust as well?
@ElianCodes |
Changes
Testing
I tested using the examples, replacing in
package.json
the@astrojs/sitemap
version withworkspace:*
and making sure it's usingoutput: "server"
in theastro.config.mjs
.Optional: adding
const prerender = true
to a few routes.Run
astro build
and make sure asitemap.xml
is created with no duplicated routes and every SSR route is created.Optional-2: Add a hardcoded
customPages
definition to sitemapoptions
.Docs
If you wish to use this implementation, I'm happy to update the docs.
/cc @withastro/maintainers-docs for feedback!