Docs
SEO
What LocalePro puts in the head of a translated page, how sitemaps and translated addresses work, and how search engines find each language.
A translated page is the same WordPress page at a different address. LocalePro’s job for search engines is to say so clearly: which language the page is in, where the other languages live, and which address is the canonical one. All of it happens as the page renders. There is nothing to configure.
Language of the document
On a translated page, the lang attribute on html is set to the language being read, in BCP-47 form (es, pt-BR, zh-Hant). The dir attribute follows it, so a right-to-left language gets dir="rtl" and the theme’s RTL stylesheet. A page that an exclusion rule leaves untranslated keeps the source language in lang, because that is what its text actually is.
Every page also carries a Content-Language response header naming the language it was rendered in.
No second translation in the browser
A page LocalePro has translated gets translate="no" on html and a meta name="google" content="notranslate" tag, so Chrome does not offer to translate it again. A page served untranslated does not get them. The filter localepro_disable_browser_translation turns them off.
The same translate="no" attribute works the other way on your own markup: an element with translate="no", class notranslate, or data-localepro-ignore is left alone by every pass, including link rewriting. See content and exclusions.
Canonical
The canonical URL WordPress prints is rewritten to the current language’s address, translated slug included. A canonical, next, prev, or shortlink link an SEO plugin prints is rewritten the same way, as are og:url and twitter:url.
For a page set to Your own version in one language, the canonical is the original page’s address under that language’s prefix. The hand-written post’s own permalink is not used.
og:locale
SEO plugins write og:locale from the site language. On a translated page it is rewritten to the language being served, in Open Graph’s language_TERRITORY form (es_ES, pt_BR). A language with a script or a region that is not a country (zh-hant, es-419) uses the default territory for its language. The filter localepro_og_locale changes the value. No og:locale:alternate tags are added.
hreflang
Each page prints one link rel="alternate" hreflang per language, early in the head:
- The source language, pointing at the untranslated address.
- Each language you offer, pointing at its translated address, with translated slugs applied.
x-default, pointing at the source language.
Per-page settings change the list:
- A language set to Off for that page is left out.
- A language set to Another page points at that page’s own address rather than the original slug under the prefix.
- A language an exclusion rule answers with a 404 is left out. A rule that redirects or shows the page untranslated keeps its entry, because that address still answers.
On the front page, the alternates point at the home URL under each prefix. hreflang links are never touched by link rewriting, so each one keeps pointing at its own language.
The same relationship is also declared inside Yoast and Rank Math sitemaps, as xhtml:link rows on each URL. The links on the page remain the source of truth for a crawler that never opens a sitemap.
Structured data
A script type="application/ld+json" block is skipped by the ordinary HTML pass, so LocalePro walks it separately. Two things change inside the graph:
- Prose fields (
name,headline,description,articleBody, and similar) are translated. Anameunder aPerson, or underauthor,creator, and similar keys, is not. url,@id, and other URL fields that point at this site are given the language prefix, so the graph agrees with the canonical a few lines above it.
This runs on every translated address, including a page set to Your own version, because the wrong addresses are there either way. If the translated JSON could break out of the script element, the block is left exactly as found. The filter localepro_translate_json_ld turns the pass off.
Translated addresses
Each post can have its own slug per language, set in the editor’s language panel; see page-by-page control. Hierarchical pages translate each segment of the path. Terms can have translated slugs, and the archive bases (/category/, /product-category/) can be translated under Settings → Languages.
A request that reaches a post through its source slug under a language prefix (/es/about-us/ when the Spanish slug is sobre-nosotros) is redirected with a 301 to the translated address, so one page has one URL in each language. Renaming a language’s address segment (/es/ to /espanol/) also 301s the old one.
Internal links in the page are rewritten to the translated addresses, so a visitor and a crawler stay inside the language. Links to files, wp-admin, the REST API, other hosts, and anchors are left alone.
Sitemaps
Each language gets a complete sitemap tree under its prefix, and robots.txt gains one Sitemap: line per language.
On a site using WordPress’s own sitemap, that tree is /es/wp-sitemap.xml. Yoast SEO and Rank Math turn the core sitemap off and serve /sitemap_index.xml instead; LocalePro rewrites those responses, so /es/sitemap_index.xml lists child sitemaps under /es/, each child lists translated addresses, and each URL carries xhtml:link hreflang alternates.
A page set to Off in a language, or one an exclusion rule answers with a 404, is dropped from that language’s sitemap.
Browser-language redirect
If Send first-time visitors to the language their browser asks for is on under Settings → Visitors, a first visit to a source-language page may be redirected with a 302. Crawlers and logged-in users are never redirected, so the source address keeps indexing normally. Source-language responses then carry Vary: Accept-Language, Cookie, so a shared cache does not serve one visitor’s redirect to another.
How a search engine finds each language
- It crawls the source page and reads the hreflang links, which name every language version and its address.
- It follows internal links, which on a translated page already point at translated addresses.
- It reads
robots.txt, which lists one sitemap per language. - On each translated page it finds a canonical pointing at itself, an
html langnaming the language, and structured data whose URLs match.
Related
- Languages and URLs, for address segments per language.
- Page-by-page control, for translated slugs and the four per-language modes.
- Caching and CDN, for what a page cache needs to know.