Skip to content
Source
Sign inSign up
TanStack/router

docs(router): clarify static title fallback in SPA mode #8840

Send to my agent
Opentulepbergenov(GitHub profile, opens in a new tab) opened this issue 0 comments

What would you like to see?

The SPA document head guide says to remove the static <title> from index.html when using <HeadContent />. It would help to explain why this is necessary and what to do if the app still needs a fallback title before JavaScript runs.

In SPA mode, the initial HTML response is the same for every route, so route-specific metadata is only available after the router runs. A static title can provide a useful fallback, but HeadContent currently doesn't adopt or replace that unmanaged title, so leaving it in place can result in duplicate titles.

Could the docs clarify this trade-off and recommend prerendering or SSR when route-specific metadata needs to be present in the initial HTML? It would also be useful to mention a supported pattern for retaining a generic fallback title without leaving duplicate title elements after the app starts.

Why is this needed?

Some apps don't need search indexing, but still want a sensible browser-tab title if JavaScript is disabled, blocked, or fails to load. The current instruction to remove the title is easy to follow without realizing that the initial document then has no title until client-side rendering.

I found the existing discussion about route titles: https://github.com/TanStack/router/discussions/1056

Sign in to join this conversation.