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

未关闭 适合新手
#8,840 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Rohan-Dedhia 已经在做这个了。

开始于 2026年11月4日。

  • #8873 来自 @Rohan-Dedhia —— 未关闭

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
62/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
活跃
技术栈
html, react, typescript
领域
documentation

调研方向

该指南是 TanStack Router 文档中关于 SPA 文档 head 的页面,其中说明了要从 index.html 中移除静态的 <title>,并与 <HeadContent /> 一同出现。请先阅读该部分,然后查看链接的讨论 #1056,了解此前关于路由标题的背景。完成的标准是:文档解释了为什么必须移除静态标题、移除后初始 HTML 的样子,并推荐对路由特定的元数据使用预渲染或 SSR,同时提供受支持的回退方案。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
TypeScript
星标
15.3k
派生
1.9k
平均合并
1 天 7 小时
30 天内合并 PR
63

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/router 的其他 Issue

查看 TanStack/router 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。