Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

fix(seo): define a bounded canonical URL strategy for NPM Stats

Đang mở
#1,152 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
frontend, web-dev

Hướng nghiên cứu

Bắt đầu với src/routes/stats/npm/index.tsx, đặc biệt là phần xác thực route và staticData.includeSearchInCanonical, sau đó lần theo hành vi của URL canonical, dữ liệu có cấu trúc, liên kết nội bộ và sitemap. Xác định mô hình URL có phạm vi giới hạn, phân biệt ngữ nghĩa với cách trình bày, trước khi triển khai mô hình đó, đồng thời thêm các bài kiểm thử cho các tổ hợp mặc định, package, scoped-package, so sánh, chỉ UI và không hợp lệ. Hoàn thành có nghĩa là chỉ những URL ổn định, có ý nghĩa mới có thể được lập chỉ mục và siêu dữ liệu của chúng phải khớp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

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.
Ngôn ngữ chính
TypeScript
Star
1.1k
Fork
401
Merge trung bình
18 giờ 44 phút
Pull request đã merge (30 ngày)
55

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TanStack/tanstack.com

Tất cả issue của TanStack/tanstack.com

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.