Hreflang for bilingual sites: English and Swahili

Many businesses in East Africa serve customers in English and Swahili. If you publish both, you want a Swahili speaker to see the Swahili page in Google and an English speaker to see the English one, rather than the two competing with each other. That is the job of hreflang.
What hreflang does
Hreflang is an annotation that tells Google a page has versions in other languages or for other regions, and where to find them. Google describes it as a way to tell it about localised versions of a page so it can show users the most appropriate version.
It does not tell Google what language a page is in. Google says it doesn't use hreflang or the HTML lang attribute to detect a page's language; it works that out from the visible content. So each page should be written entirely in one language, navigation included.
Hreflang can be added in three ways: link elements in the page's head, HTTP headers (useful for files such as PDFs), or entries in the XML sitemap. Pick one method and use it consistently.
The rules that matter
- Reciprocal links. Google states that each language version “must list itself as well as all other language versions”. If the English page points to the Swahili one but the Swahili page does not point back, the annotations may be ignored.
- Self-reference. Each page includes a hreflang entry for itself as well as for its alternates.
- Correct codes. Languages use ISO 639-1 codes (en for English, sw for Swahili), optionally followed by an ISO 3166-1 alpha-2 region code: en-KE, sw-KE, sw-TZ. A region on its own is not valid.
- Full URLs. Each alternate is listed by its full address, including https://.
- x-default. The reserved value x-default names the page to show when no listed language matches the searcher's settings, often the English version or a language chooser.
Keep the pairs one-to-one
Hreflang works best when the pages really are the same page in two languages: the Swahili page on blood pressure readings pairs with the English page on blood pressure readings, not with a general health page. Pair each page with exactly one equivalent per language. If a Swahili page has no English equivalent, it simply has no hreflang partner, and that is fine.
In practice this means keeping a clear record of which page translates which. A column in your content spreadsheet that holds the address of the equivalent page is enough, and it makes the links easy to generate and check.
Separate subdomains are fine
You do not have to put both languages on the same host. Google's documentation says alternate URLs “do not need to be in the same domain”, and its multi-regional guidance lists subdomains as one of the accepted structures, alongside subdirectories and country domains. A Swahili site on its own subdomain (for example afya.example.co.ke beside guides.example.co.ke) can be linked to its English twin with hreflang, as long as the links are reciprocal.
Google also recommends using different URLs for each language rather than switching the language on one URL, and warns against automatically redirecting visitors to a language version based on guesses about their language, because it can stop both people and crawlers from reaching the other versions. Offer a visible language link instead.
Translation vs writing natively
Hreflang tells Google the pages are equivalent; it cannot make a poor translation read well. People search in the words they actually use, and a word-for-word translation of an English page often uses terms a Swahili speaker would never type. Writing each language version natively, from the same facts, tends to produce pages that match real searches and read naturally.
If you use machine translation or AI to draft, have a fluent speaker review every page before it goes live. Google's guidance on generative AI content asks publishers to check AI-generated content for accuracy, and its scaled content abuse policy gives, as one example, generating many pages from other content through automated transformations, translation included, “where little value is provided to users”.
Common mistakes
- Return links missing on one side.
- Using a country code where a language code belongs, such as ke instead of sw-KE.
- Pointing hreflang at pages that are blocked, redirected or set to noindex.
- Pairing pages that are not really equivalents.
- Mixing languages on one page, so neither version is clearly one language.
- Redirecting visitors by browser language, which can hide a version from crawlers.
Searchlode handles this with a translation_of link on each translated page: the Swahili site is set up as the same site in another language, each page names the English page it translates, and the hreflang pairs in both directions are generated from that. The Swahili content itself is written in Swahili, not translated word for word.