๐ŸŒ Multilingual Sites

Last updated๏ผš2026-11-25

Check the languages under the admin “Site Management โ†’ One-click Enable Language Sites”, and the system automatically creates an independent site, template directory, and category/navigation skeleton for each language, auto-generates a language switcher on the front end, and isolates all content by site_id. Admin path: Admin โ†’ Site Management (/admin/sites)

โš ๏ธ Edition Requirement (Read First)

The multilingual feature requires a Professional or above license. Even if Basic edition customers follow this chapter’s steps to add language sites, the front end will not output the language switcher or hreflang tags (the system automatically degrades to single-language).

The determination is based on “whether Professional / Enterprise edition was ever purchased”, regardless of whether the service is within its validity period โ€” after buying Professional, a customer’s multilingual sites keep working even without renewal. See ๐Ÿ”‘ License and Email Services.

  • {{.LangSwitcher}} Language switcher data (array) NEW โ€” array
  • {{.SiteCode}} Current site code (e.g. zh, en) โ€” text
  • {{.SiteLanguage}} Site language (e.g. zh-CN, en) โ€” text
  • {{.SiteID}} Current site ID โ€” number

Each LangSwitcher object contains Code (site code), Name (display name), URL (jump address), IsCurrent (whether current).

{{.LangSwitcher}} is the “language switcher button” data shown to visitors; {{.HrefLangs}} is `cross-link data meant specifically for search engines. They serve different purposes but are often used together. The system automatically generates the absolute URL of the corresponding language version for **every enabled site**, plus onex-default` entry (pointing to the default site’s same path). - {{.HrefLangs}} hreflang cross-link array (non-empty only with multiple sites; nil for a single site) NEW โ€” array

Each HrefLangs element contains two fields: Lang (language code, e.g. zh-CN / en / x-default) and Href (absolute URL of that language version).

<!-- Place after the canonical in <head> -->
{{range .HrefLangs}}<link rel="alternate" hreflang="{{.Lang}}" href="{{.Href}}">
{{end}}
โš ๏ธ ๆณจๆ„

{{.HrefLangs}} is non-empty only when more than one site is enabled; single-language sites need not output it (search engines only need the canonical). Output order does not affect SEO.

๐Ÿ’ป Usage Example

<!-- Language switcher buttons -->
{{if .LangSwitcher}}
<div class="lang-switch">
  {{range .LangSwitcher}}
  <a href="{{.URL}}" class="lang-item{{if .IsCurrent}} active{{end}}">{{if .Name}}{{.Name}}{{else}}{{.Code}}{{end}}</a>
  {{end}}
</div>
{{end}}
<!-- Detect the current language -->
{{if eq .SiteCode "en"}}
<span>Currently on the English site</span>
{{else}}
<span>Currently on the Chinese site</span>
{{end}}
<!-- Multilingual header (navigation + switcher) -->
<nav>
  {{range .Navigations}}
  {{if eq .Location "header"}}
  <!-- For nav highlighting see 05-navigation.html: map CurrentNav to the first path segment and add is-current -->
  <a href="{{.Link}}" target="{{.Target}}" class="nav-link {{if eq .CurrentNav "news"}}is-current{{end}}">{{.Name}}</a>
  {{end}}
  {{end}}
</nav>
{{if .LangSwitcher}}
<div class="lang-switch">
  {{range .LangSwitcher}}<a href="{{.URL}}" class="lang-item{{if .IsCurrent}} active{{end}}">{{.Name}}</a>{{end}}
</div>
{{end}}

โš™๏ธ Multilingual Site Setup Steps (One-click Enable)

  1. In the admin “Site Management” โ†’ “One-click Enable Language Sites”, check the languages you need (en / ja / ko / fr / de / es / ru / pt / it / vi / th / id) and click “Enable Selected Languages”.
  2. The system automatically completes for each language:
    • Creates a new sites record: site_code, language, and tpl_path are all the language code (e.g. en), domain left empty, and the front end served under the /en/ subdirectory;
    • Copies the default Chinese site’s company info, SEO, footer settings, and the category and navigation skeleton (without content data);
    • Copies the template directory currently used by the Chinese site into an independent template set: multi-tenant lands in <tenant-dir>/templates/en/, standalone lands in templates/en/; if the directory already exists it is not overwritten, protecting your modified files;
    • Rebuilds the template cache; the front end /en/ is immediately accessible.
  3. Switch to that language site’s admin and enter content in that language; or use “Copy for Translation / AI Site-wide Translation” to generate a draft and polish it manually.
  4. Translate the hardcoded Chinese copy (navigation, buttons, footer) in the copied template into the target language. Language templates are independent โ€” changing the English site does not affect the Chinese or Japanese sites.
  5. Add {{range .LangSwitcher}} to the header to show the switcher; {{.HrefLangs}} hreflang is generated automatically by the system โ€” no need to hand-write it.
  6. Enabled languages show “Enabled” in the checkbox area and are disabled; resubmitting does not create duplicate sites or overwrite existing template directories.

The manual method still works: use “Add Site” to fill in name / site code / language one by one, keeping the template directory at the default “auto-create (by site code, copied from the Chinese template)”; or select an existing shared template directory directly from the dropdown.

โš ๏ธ Three Easy Pitfalls

  • Edition requirement at the top: Basic edition can create sites, but the /en/ front end will not take effect (the system automatically degrades to single-language), and pages will show a notice after enabling.

  • What gets copied is a Chinese template copy; hardcoded copy in the HTML still needs per-language translation; the system does not auto-translate template files.

  • After changing template files, re-save the site info once in the admin (or restart the engine) for them to reload; under multi-tenant, <tenant-dir>/templates/<code>/ takes priority, and same-named files in the shared templates/en/ are overridden by it.

    โ† On-site Search Template Packaging Specification โ†’

This site uses cookies for essential functionality and to improve your experience. See our Privacy Policy.