Navigation
This page demonstrates a hybrid rendering strategy in Next.js, where the content swaps between static server-rendered and client-only content based on the "Page exists" checkbox on the form.
/form
page, the user can tick the "Page exists" checkbox. If ticked and "Static" is selected, the app redirects to /form/static-page?pageExists=true
. If not ticked, it redirects to /form/static-page
.pageExists
query parameter:pageExists
is false or missing: Renders static heading, description, and server-fetched posts (all visible in the page source).pageExists
is true: Renders only the static info bar and link, and swaps in the ResultsClient
component for client-only results (not in the page source).pageExists
variable. When true, the static content is hidden and ResultsClient
is rendered instead, with hideClientFooter
to hide its own footer/button.Checkbox | URL | SSR Content | Client Content |
---|---|---|---|
Unticked | /form/static-page | Static heading, description, posts, info bar, link | (same as SSR) |
Ticked | /form/static-page?pageExists=true | Static info bar, link | ResultsClient: heading, description, posts (client-only) |
This hybrid approach is great for demonstrating both SEO-friendly static content and privacy-focused client-only rendering in a single Next.js app.