Conversation
This comment was marked as outdated.
This comment was marked as outdated.
🦋 Changeset detectedLatest commit: fac8782 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
Hello! Thank you for opening your first PR to Starlight! ✨ Here’s what will happen next:
|
|
For anyone that want to try this out on their website to check for problems you can install it with: |
|
Probably blocked by withastro/astro#9392, due to that bug any project using Starlight with SSR cannot add any other page to the project as everything will be overridden by Starlight's |
|
Any updates on that? I have to patch package to add |
|
This depended on withastro/astro#9439, released on 4.2. It's on my pipe to come back to this and make any necessary changes. I'll probably ping people to review it by next Tuesday. |
|
waiting for this to be released 🙏 |
| }); | ||
| } | ||
|
|
||
| if (context.config.output === 'static' && !starlightConfig.prerender) { |
There was a problem hiding this comment.
I guess we’ll need to revisit this for Astro v5 given withastro/astro#11824 — probably something like checking there’s an adapter? (No action needed, just sharing the observation to up our chances of one of us remembering 😁)
There was a problem hiding this comment.
This PR is almost the entirety of v4. It started two days after 4.0.0 and now we have to consider how v5 just around the corner will break it 😅
[skip ci] Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
There was a problem hiding this comment.
Thanks for the last updates @Fryuni! Looks good to me! 🎊
I think one thing we can think about for the future is if this needs any more documentation (the current SSR section is a bit hidden in the manual setup guide), but I’m happy to run with this as it’s a rarer option for people.
Will take a look to see if there are other things we’d like to get released with this and decide when to cut the next minor.
|
Updated the end-to-end fixtures to the latest Astro release to match the updates in #2287 — tests still all seem good! |
|
Just wanted to say I'm excited! 🥳 Congrats, @Fryuni ! |
|
Hey, folks! I just wanted to let you know that I've been following this PR for the last couple of months and wanted to congrats everyone involved on this effort. You did an amazing job here @Fryuni @HiDeoo and @delucis! I'm saving this PR as an example of open source contribution. Really cool to see these in-depth discussions happening async, and moving forward! Again, congrats and thank you @Fryuni ! |
|
Trabalho incrível, @Fryuni! Congrats team! |
|
🎉 |
Summary
Add configuration for not prerendering Starlight pages.
This enables using components with SSR logic on Starlight pages, whether in the content or as component overrides.
Notes
Double index
To do this without triggering multiple warnings, there are now two
.astropages for the index entrypoint:index.astrois always prerendered and usesgetStaticPathsandAstro.propsto receive information about the route.indexSSR.astrothat is never prerendered and retrieves the information about the route from the dynamic route parameter.Route parameter indexing
To make the SSR rendering efficient, a lookup map for all the content was created using the parameter that will be received from the dynamic route.
Pagefind
Pagefind indexing requires access to the HTML file generated by the routes, but those are not available when building for SSR, so Pagefind is not supported when using SSR.
The solution that I implemented for this is that when both SSR and Pagefind are enabled for Starlight, the content of the docs is pre-rendered for indexing but not included in the final build. The final content served will be from SSR, but the index will be built from that static rendering.Default behavior
Starlight will default to the same as any other Astro page, prerendering when the output mode is not defined, when it isstatic, and when it ishybrid. When the output mode isserver, Starlight will default to SSR.Starlight previously didn't build at all when the site had output mode set toserver, so the different default is not, AFAICT, a breaking change.Starlight will default to prerender pages, which differs from the default for Astro pages. This is to maintain compatibility and because docs pages are most commonly not dynamic. Users must set
prerender: falsein their Starlight configuration to enable on-demand docs page rendering. At the moment, this applies to all Starlight pages. Future work could be done to support SSR on only some of the pages.TODO
child_processlogic to build plugins (git information)