TanStack / TanStack/tanstack.com

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

Aperta
#1,152 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug
Lingua principale
TypeScript
Stelle
1.1k
Fork
401
Merge medio
18h 14m
PR unite (30g)
56

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da src/routes/stats/npm/index.tsx, in particolare dalla validazione delle route e da staticData.includeSearchInCanonical, quindi traccia il comportamento degli URL canonical, dei dati strutturati, dei link interni e della sitemap. Definisci il modello circoscritto di URL semantico rispetto alla presentazione prima di implementarlo e aggiungi test per le combinazioni predefinite, di package, di package con scope, di confronto, solo UI e non valide. Il lavoro è completo quando sono indicizzabili solo URL stabili e significativi e i relativi metadati corrispondono.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
frontend, web-dev
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.