SEO

seo/canonical-valid

A page has at most one rel="canonical", in the head, with an absolute URL of an indexable page and no fragment.

umiarkowanastatycznefe-seo-metadata

Dlaczego

The canonical tells search engines which of several URLs with the same content to show (with and without parameters, trailing slash, www). Two canonicals, a relative path resolved against the wrong base, or a fragment make search engines ignore the hint and pick one themselves.

Poprawka

Emit one <link rel="canonical" href="https://example.com/path"> per page from the layout, built from the site's configured origin and the clean path (no tracking parameters, no #). Point it at a page that returns 200 and is not noindex. Keep sitemap URLs equal to canonical URLs.

Przykłady

<!-- bad -->
<link rel="canonical" href="/pricing">
<!-- good -->
<link rel="canonical" href="https://example.com/pricing">

Źródła

Fakty

Identyfikator
seo/canonical-valid
Waga
umiarkowana
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
html vue svelte astro jsx
Ten sam problem w
Lighthouse canonical
Uczy jej skill
fe-seo-metadata SEO and metadata
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain seo/canonical-valid