Skip to content
Documentation

Publish Arabic and right-to-left docs

Add Arabic or another language to your site, link each page to its translation, and check right-to-left layout, mixed text, and search.

  • 3 min read
  • Updated

Each language on your site has its own list of pages and its own text direction. Arabic pages read right to left, while code and commands stay left to right. Readers switch languages with the language switcher on your published site.

  1. In the editor, select Add language. You can also use Settings → Languages → Add language.
  2. Choose the language from the list. For a language that isn't listed, select Add a language not listed and enter its Code (such as ar), a Label, and its Direction: Right to left for Arabic, Hebrew, Persian, or Urdu.
  3. Write pages in the new language. Select New page while that language is open in the editor.

Each language has a Language settings dialog in the editor with its Label, Direction, whether it is the Default language, and its Site title, Default description, and search-engine settings. To translate the site name and description shown to readers, use Settings → General → Translations.

Linking a page to its translation lets the language switcher take readers to the same page in the other language. It also adds hreflang links, which tell search engines which pages are translations of each other.

  1. Open the English page and select Page settings, then More options.
  2. Copy its Translation key, or type a short one such as getting-started.
  3. Open the Arabic page and set the same Translation key.

The pages can have different addresses. For example, /getting-started in English can match /البدء in Arabic.

Only link real translations. Don't create empty copies just to fill the list.

Settings → Languages shows how many default-language pages each language covers, and how many are missing. From there you can also:

  • Make default to change the language visitors see first;
  • switch off Serve … on the published site to hide a language from readers while you keep working on it;
  • Delete language, which permanently deletes the language and all its pages.

Paste a sentence that mixes Arabic with a command, a path, and a version number, such as:

text
شغّل الأمر docker compose up -d، ثم افتح /docs?lang=ar وتأكد من الإصدار v0.2.1.

Check that line in the editor, in Preview, and on the published site. Also check:

  • the order of the sidebar, breadcrumbs, and previous and next arrows;
  • the table of contents and nested groups;
  • long code blocks and tables on a phone-sized window;
  • that copying a command gives the same text you wrote.

In the editor, put commands, file names, and settings in inline code so they keep their left-to-right order.

Arabic search handles common spelling differences. It ignores diacritics (تشكيل) and tatweel (ـ), treats the different alef forms (أ إ آ ا) as the same, and treats ى like ي. It also matches common prefixes and suffixes, so a search for a plural can often find the singular. Exact matches always rank highest.

Test search with words your readers really use: with and without diacritics, singular and plural, and product names written in Arabic and in English letters. Also check that unrelated words do not match.

Ask AI follows the reader's language too; see Answer reader questions with Ask AI.

Was this page helpful?