Skip to content
hreflang reference

hreflang="xh" — Correct Usage

Copy-paste correct usage for Xhosa — HTML, sitemap syntax and the mistakes to avoid.

xh codeXhosa targetslanguage only type

hreflang="xh" labels a URL as the Xhosa version of a page. Add it as a link tag (or sitemap entry) on every alternate version, always reciprocally and always alongside an x-default entry.

HTML head implementation

<link rel="alternate" hreflang="xh" href="https://example.com/xh/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />

XML sitemap implementation

<url>
  <loc>https://example.com/xh/</loc>
  <xhtml:link rel="alternate" hreflang="xh" href="https://example.com/xh/" />
  <xhtml:link rel="alternate" hreflang="x-default" href="https://example.com/" />
</url>

Rules that trip people up

  • Reciprocity: every alternate must link back to every other one, including itself.
  • Valid syntax: ISO 639-1 language, optionally “-” + ISO 3166-1 country (or UN M49 region like 419).
  • Point only at canonical, indexable, 200-status URLs — never at redirects.
  • hreflang suggests, canonical decides: conflicting canonicals silently break clusters.
Automate it: Transxlate Pro emits the complete, reciprocal hreflang cluster (with x-default) on every page of every language automatically — no manual tags to maintain.

Frequently asked questions

What does hreflang="xh" mean?

It tells search engines the linked URL is the Xhosa version of the page. Users searching in that locale get this URL in results instead of another language version.

Where do I put hreflang="xh"?

In one of three places (pick one, consistently): link tags in the HTML head, HTTP headers, or your XML sitemap. Every language version must list all alternates including itself — missing return links invalidate the cluster.

What are the most common hreflang mistakes?

Non-reciprocal links (A lists B, B forgets A), invalid codes (using country codes alone, or “en-EU”), pointing alternates at redirected/noindexed URLs, and forgetting the self-reference. Audit clusters with a crawler after any URL change.

Never hand-write hreflang again

Transxlate generates correct clusters for every language version automatically.