mirror of
https://github.com/getzola/zola
synced 2025-01-07 09:28:47 +00:00
315 lines
17 KiB
HTML
315 lines
17 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en-gb">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="description" content="Everything you need to make a static site engine in one binary.">
|
|
<meta name="author" content="Vincent Prouillet">
|
|
<title>Multilingual sites | Zola </title>
|
|
<link rel="stylesheet" href="https://www.getzola.org/site.css">
|
|
<link rel="icon" href="https://www.getzola.org/favicon.ico">
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<a class="header__logo white" href="https://www.getzola.org/">Zola</a>
|
|
<nav>
|
|
<ul>
|
|
<li><a class="white" href="https://www.getzola.org/documentation/" class="nav-link">Docs</a></li>
|
|
<li><a class="white" href="https://www.getzola.org/themes/" class="nav-link">Themes</a></li>
|
|
<li><a class="white" href="https://zola.discourse.group/" class="nav-link">Forum</a></li>
|
|
<li><a class="white" href="https://github.com/getzola/zola" class="nav-link">GitHub</a></li>
|
|
</ul>
|
|
<div class="search-container">
|
|
<input id="search" type="search" placeholder="🔎 Search the docs">
|
|
|
|
<div class="search-results">
|
|
<div class="search-results__items"></div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<div class="content content--reversed">
|
|
|
|
|
|
<div class="documentation">
|
|
<aside class="documentation__sidebar">
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Getting Started</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/installation/">Installation</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/cli-usage/">CLI usage</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/directory-structure/">Directory structure</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/configuration/">Configuration</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Content</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/section/">Section</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/page/">Page</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/shortcodes/">Shortcodes</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/linking/">Internal links & deep linking</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/table-of-contents/">Table of Contents</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/syntax-highlighting/">Syntax Highlighting</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/taxonomies/">Taxonomies</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/search/">Search</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/sass/">Sass</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/image-processing/">Image processing</a>
|
|
</li>
|
|
|
|
<li class="active">
|
|
<a href="https://www.getzola.org/documentation/content/multilingual/">Multilingual sites</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Templates</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/pages-sections/">Sections and Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/pagination/">Pagination</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/taxonomies/">Taxonomies</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/feeds/">Feeds</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/sitemap/">Sitemap</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/robots/">Robots.txt</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/404/">404 error page</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/archive/">Archive</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Themes</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/themes/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/themes/installing-and-using-themes/">Installing & using themes</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/themes/creating-a-theme/">Creating a theme</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/themes/extending-a-theme/">Customizing a theme</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Deployment</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/sourcehut/">Sourcehut Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/netlify/">Netlify</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/github-pages/">GitHub Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/gitlab-pages/">GitLab Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/codeberg-pages/">Codeberg Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/edgio/">Edgio</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/vercel/">Vercel</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/zeabur/">Zeabur</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/cloudflare-pages/">Cloudflare Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/flyio/">Fly.io</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/aws-s3/">AWS S3 Bucket</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/docker-image/">Docker image</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
</aside>
|
|
<div class="documentation__content">
|
|
|
|
<h1>Multilingual sites</h1>
|
|
<p>Zola supports having a site in multiple languages.</p>
|
|
<h2 id="configuration"><a class="zola-anchor" href="#configuration" aria-label="Anchor link for: configuration">🔗</a>Configuration</h2>
|
|
<p>To get started, you will need to add the languages you want to support
|
|
to your <code>config.toml</code>. For example:</p>
|
|
<pre data-lang="toml" style="background-color:#383838;color:#e6e1dc;" class="language-toml "><code class="language-toml" data-lang="toml"><span>[</span><span style="color:#e8bf6a;">languages.fr</span><span>]
|
|
</span><span style="color:#e8bf6a;">generate_feeds </span><span>= </span><span style="color:#6e9cbe;">true </span><span style="color:#95815e;"># there will be a feed for French content
|
|
</span><span style="color:#e8bf6a;">build_search_index </span><span>= </span><span style="color:#6e9cbe;">true
|
|
</span><span style="color:#e8bf6a;">taxonomies </span><span>= [
|
|
</span><span> {</span><span style="color:#e8bf6a;">name </span><span>= </span><span style="color:#c1be91;">"auteurs"</span><span>},
|
|
</span><span> {</span><span style="color:#e8bf6a;">name </span><span>= </span><span style="color:#c1be91;">"tags"</span><span>},
|
|
</span><span>]
|
|
</span><span>
|
|
</span><span>[</span><span style="color:#e8bf6a;">languages.fr.translations</span><span>]
|
|
</span><span style="color:#e8bf6a;">summary </span><span>= </span><span style="color:#c1be91;">"Mon blog"
|
|
</span><span>
|
|
</span><span>[</span><span style="color:#e8bf6a;">languages.it</span><span>]
|
|
</span><span style="color:#95815e;"># Italian language doesn't have any taxonomies/feed/search index
|
|
</span><span>
|
|
</span><span>[</span><span style="color:#e8bf6a;">languages.it.translations</span><span>]
|
|
</span><span style="color:#e8bf6a;">summary </span><span>= </span><span style="color:#c1be91;">"Mio blog"
|
|
</span><span>
|
|
</span><span style="color:#95815e;"># translations for the default language are not prefixed by languages.code
|
|
</span><span>[</span><span style="color:#e8bf6a;">translations</span><span>]
|
|
</span><span style="color:#e8bf6a;">summary </span><span>= </span><span style="color:#c1be91;">"My blog"
|
|
</span></code></pre>
|
|
<p>Note: By default, Chinese and Japanese search indexing is not included. You can include
|
|
the support by building <code>zola</code> using <code>cargo build --features indexing-ja --features indexing-zh</code>.
|
|
Please also note that, enabling Chinese indexing will increase the binary size by approximately
|
|
5 MB while enabling Japanese indexing will increase the binary size by approximately 70 MB
|
|
due to the incredibly large dictionaries.</p>
|
|
<h2 id="content"><a class="zola-anchor" href="#content" aria-label="Anchor link for: content">🔗</a>Content</h2>
|
|
<p>Once the languages have been added, you can start to translate your content. Zola
|
|
uses the filename to detect the language:</p>
|
|
<ul>
|
|
<li><code>content/an-article.md</code>: this will be the default language</li>
|
|
<li><code>content/an-article.fr.md</code>: this will be in French</li>
|
|
</ul>
|
|
<p>If the language code in the filename does not correspond to one of the languages or
|
|
the default language configured, an error will be shown.</p>
|
|
<p>If your default language has an <code>_index.md</code> in a directory, you will need to add an <code>_index.{code}.md</code>
|
|
file with the desired front-matter options as there is no language fallback.</p>
|
|
<h2 id="output"><a class="zola-anchor" href="#output" aria-label="Anchor link for: output">🔗</a>Output</h2>
|
|
<p>Zola outputs the translated content with a base URL of <code>{base_url}/{code}/</code>.
|
|
The only exception to this is if you are setting a translated page <code>path</code> directly in the front matter.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<footer>
|
|
©2017-2024 — <a class="white" href="https://www.vincentprouillet.com">Vincent Prouillet</a> and <a class="white" href="https://github.com/getzola/zola/graphs/contributors">contributors</a>
|
|
</footer>
|
|
|
|
<script type="text/javascript" src="https://www.getzola.org/elasticlunr.min.js"></script>
|
|
<script type="text/javascript" src="https://www.getzola.org/search.js"></script>
|
|
</body>
|
|
</html>
|