Repository navigation
Conversation
A shell request with the ssr query parameter (any value) gets the body search-engine crawlers get, whatever its user agent, and the SPA does not mount while #root holds the server's markup, so site owners can check what crawlers see. Without a body (private wiki, unknown page, SPA route) the SPA mounts as usual. Same public-access gate, render cache and parallel-render cap as for crawlers (#1292).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Part of #1292
What changed
Add
?ssrto a page URL of a public wiki (e.g./docs/setup?ssr=1) to see in the browser the HTML that search-engine crawlers get. Any value works, including?ssr=and a bare?ssr.internal/wiki/seo): with thessrquery parameter, the crawler-body contributor puts the server-rendered page into#rootfor any user agent. Without the parameter, only crawler user agents get it. It sits behind the samePublicOnlygate and uses the same render cache and parallel-render cap. The body was already reachable before: any client could get it by sending a crawler user agent.src/lib/ssrPreview.ts,main.tsx): with?ssr, the SPA does not mount while#rootholds an element, so the server's markup stays on screen. Without a server body (private wiki, unknown page, SPA route, permalink) the SPA mounts as usual, so the parameter never leaves a blank page./?ssrstill redirects to the first page, without the parameter. Links inside the preview carry no?ssr, so following one opens the normal SPA.How I tested it
Previewgives any user agent the body, and returns nothing where crawlers get nothing) and for the contributor (parameter variants, unknown page, public access off), plus an integration test on the real router under--base-path /wiki.isSSRPreviewwith parameter variants, an empty#root, and the bare{{__BODY__}}placeholder the Vite dev server serves.seo-crawler-body.spec.ts): with?ssrthe server article stays and the browser makes no/api/request, which shows the SPA never mounted. On an unknown page,?ssrlets the SPA mount normally. Negative check: with the mount guard disabled, the spec fails.make lint,make verify,make cross, the Go tests forinternal/wikiandseo, the full Vitest suite, UI lint and UI build all pass. I ran the e2e spec against a locally built binary and it passed.Checklist
if featurebranches in shared code (rule 1)Behavior-Change:trailer (commit style). Not needed here: the parameter is opt-in and nothing existing changes.🤖 Generated with Claude Code