fix(seo): define a bounded canonical URL strategy for NPM Stats
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- typescript
调研方向
从 src/routes/stats/npm/index.tsx 开始,重点检查路由验证和 staticData.includeSearchInCanonical,然后跟踪 canonical、结构化数据、内部链接和 sitemap 的行为。在实现之前,先定义有界的语义与呈现 URL 模型,并为默认、包、作用域包、比较、仅 UI 和无效组合添加测试。完成的标准是,只有稳定且有意义的 URL 可被索引,并且其元数据相匹配。
由索引模型根据 Issue 内容生成。
描述
Problem
The clean /stats/npm URL currently redirects to a URL that serializes the complete default chart state. In a live audit, the resulting canonical URL was 2,355 characters long.
The route validates defaults for packageGroups, range, chart type, transforms, playback controls, legend state, dimensions, and other UI settings, then staticData.includeSearchInCanonical causes all of those values to become canonical. Each user interaction can therefore create another indexable URL.
Relevant route: src/routes/stats/npm/index.tsx
Google warns that parameter-driven faceted navigation can generate effectively infinite crawl spaces and slow discovery of useful pages: https://developers.google.com/crawling/docs/faceted-navigation
Goals
- Keep NPM Stats URLs shareable.
- Index only clean, stable pages with meaningful search intent.
- Prevent display and playback controls from creating indexable canonical variants.
Proposed direction
- Make /stats/npm a stable 200 URL with a clean self-canonical, or normalize to another intentionally short canonical URL.
- Omit default values from serialized search parameters.
- Separate semantic state from presentation state.
- Treat parameters such as range, transform, bin type, view mode, chart type, sorting, dimensions, playback, legend visibility, and similar controls as non-indexable UI state.
- Define a bounded format for package or package-comparison pages that should be indexable, potentially using stable path-based package identifiers rather than encoded JSON.
- Canonicalize or noindex non-semantic variants according to the chosen model.
- Ensure scoped package paths resolve correctly and have one canonical encoding.
- Make WebApplication JSON-LD url and any BreadcrumbList URLs match the selected canonical.
- Review FAQPage JSON-LD. Google does not normally show FAQ rich results for non-government and non-health sites, so retain it only if another consumer justifies the maintenance.
Acceptance criteria
- Loading /stats/npm does not redirect to a URL containing the full default chart configuration.
- The default canonical is short, stable, and self-referencing.
- Default values are omitted from generated links.
- Presentation-only variants do not self-canonicalize as independently indexable pages.
- Any intentionally indexable comparison page has unique SSR title, description, H1, canonical, and structured data based on the compared packages.
- Nonsensical or empty package combinations return an appropriate 404 or noindex response rather than another indexable state.
- Tests cover default state, one package, scoped packages, multi-package comparison, UI-only controls, and invalid combinations.
- Internal links and sitemap entries expose only the bounded set of indexable URLs.
- 主要语言
- TypeScript
- 星标
- 1.1k
- 派生
- 401
- 平均合并
- 16 小时 8 分钟
- 30 天内合并 PR
- 58
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
TanStack/tanstack.com 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
TanStack/tanstack.com#1293 ·
-
source-audit
难度 1/5 1 小时以内 新手友好度 84/100
TanStack/tanstack.com#1195 ·
-
source-audit
难度 2/5 1-3 小时 新手友好度 68/100
TanStack/tanstack.com#1194 · 2 条评论 ·
-
source-audit
难度 2/5 1-3 小时 新手友好度 72/100
TanStack/tanstack.com#1177 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 64/100
TanStack/tanstack.com#1059 ·
查看 TanStack/tanstack.com 的全部 Issue
相似的 Issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 1/5 1 小时以内 新手友好度 85/100
-
Mend: dependency security vulnerability untriaged
难度 2/5 1-3 小时 新手友好度 70/100