Artykuł główny · pojęcie · Pojęcia · Pozostałe
Hreflang (hreflang)
także: hreflang · wersje językowe strony · alternate hreflang
Znacznik informujący Google o wersjach językowych i regionalnych tej samej strony pod różnymi adresami.
Rozszerzona definicja
Hreflang to znacznik, który mówi Google, że dana strona ma wersje językowe lub regionalne pod innymi adresami. Dzięki niemu wyszukiwarka może pokazać użytkownikowi wersję w jego języku, a nie przypadkową1.
Hreflang nie służy do wykrywania języka — Google robi to algorytmicznie i nie używa do tego ani hreflang, ani atrybutu `lang`2.
Jak to działa
Są trzy równoważne metody: znaczniki `<link rel="alternate" hreflang>` w `<head>`, nagłówek HTTP `Link` oraz wpisy w sitemapie. Google traktuje je jednakowo — nie ma sensu wdrażać wszystkich naraz3.
Każda wersja musi wskazywać siebie i wszystkie pozostałe4, a jeśli dwie strony nie wskazują się nawzajem, znaczniki są ignorowane5. Adresy muszą być pełne, z protokołem (http lub https)6.
Dlaczego to ważne
Bez hreflang Google może pokazać Polakowi wersję angielską. Wersje językowe są uznawane za duplikaty tylko wtedy, gdy główna treść strony pozostała nieprzetłumaczona7 — ale przy niepełnych adresach i braku linków zwrotnych i tak tracisz kontrolę nad tym, którą wersję zobaczy użytkownik.
Częste błędy i mity
- Brak linków zwrotnych — najczęstszy błąd; bez nich znaczniki są ignorowane5.
- Kod regionu bez języka (np. `be`) — nieprawidłowy; pierwszy człon to zawsze język8.
- Kody typu `EU`, `UN`, `UK` — Google ich nie obsługuje w hreflang9.
- Brak `x-default` dla użytkowników, których język nie pasuje do żadnej wersji10.
Powiązane hasła
Źródła i odwołania
-
Tell Google about localized versions of your page
If you have multiple versions of a page for different languages or regions, tell Google about these different variations. Doing so will help Google Search point users to the most appropriate version of your page by language or region.
-
Tell Google about localized versions of your page
Google doesn't use hreflang or the HTML lang attribute to detect the language of a page; instead, we use algorithms to determine the language.
-
Tell Google about localized versions of your page
The three methods are equivalent from Google's perspective and you can choose the method that's the most convenient for your site.
-
Tell Google about localized versions of your page
Each language version must list itself as well as all other language versions.
-
Tell Google about localized versions of your page
If two pages don't both point to each other, the tags will be ignored.
-
Tell Google about localized versions of your page
Alternate URLs must be fully-qualified, including the transport method (http/https)
-
Tell Google about localized versions of your page
Localized versions of a page are only considered duplicates if the main content of the page remains untranslated.
-
Tell Google about localized versions of your page
You can't specify the country code by itself. The first code stands for the language and Google doesn't automatically derive the language from a country code.
-
Tell Google about localized versions of your page
If you use codes that are listed as reserved for something else, Google Search ignores that part of the annotation (for example, using EU, UN, or UK in hreflang annotations doesn't have an effect on Google Search).
-
Tell Google about localized versions of your page
The reserved x-default value is used when no other language/region matches the user's browser setting.
Każde zdanie powyżej odsyła do dosłownego cytatu ze źródła. Daty to daty publikacji lub pobrania źródła.
Źródła faktów
- Hreflang wskazuje Google wersje językowe i regionalne strony. — web
- web