Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix hierarchical_pages README
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
- Loading branch information
Showing
1 changed file
with
32 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,50 @@ | ||
This plugin allows to translate paths by specifying paths in a hierarchy. | ||
|
||
Assume you have the following hierarchy of posts (default language English): | ||
- `about.rst` | ||
- `about/company.rst` | ||
- `about/team.rst` | ||
- `about/team/nikola-tesla.rst` | ||
- `about/team/roberto-alsina.rst` | ||
|
||
* `about.rst` | ||
* `about/company.rst` | ||
* `about/team.rst` | ||
* `about/team/nikola-tesla.rst` | ||
* `about/team/roberto-alsina.rst` | ||
|
||
Assuming you have set `PRETTY_URLS` to `True` and `SITE_URL` to `https://example.com`, | ||
you can access the pages with the following URLs: | ||
- `https://example.com/about/` | ||
- `https://example.com/about/company/` | ||
- `https://example.com/about/team/` | ||
- `https://example.com/about/team/nikola-tesla/` | ||
- `https://example.com/about/team/roberto-alsina/` | ||
|
||
* `https://example.com/about/` | ||
* `https://example.com/about/company/` | ||
* `https://example.com/about/team/` | ||
* `https://example.com/about/team/nikola-tesla/` | ||
* `https://example.com/about/team/roberto-alsina/` | ||
|
||
Now assume you want to make your homepage available in more languages, say | ||
also in German. You want the URLs for the translated posts to be: | ||
- `https://example.com/de/ueber/` | ||
- `https://example.com/de/ueber/firma/` | ||
- `https://example.com/de/ueber/mitarbeiter/` | ||
- `https://example.com/de/ueber/mitarbeiter/nikola-tesla/` | ||
- `https://example.com/de/ueber/mitarbeiter/roberto-alsina/` | ||
|
||
* `https://example.com/de/ueber/` | ||
* `https://example.com/de/ueber/firma/` | ||
* `https://example.com/de/ueber/mitarbeiter/` | ||
* `https://example.com/de/ueber/mitarbeiter/nikola-tesla/` | ||
* `https://example.com/de/ueber/mitarbeiter/roberto-alsina/` | ||
|
||
This can be achieved with the `hierarchical_pages` plugin. If you create | ||
translations: | ||
- `about.de.rst` | ||
- `about/company.de.rst` | ||
- `about/team.de.rst` | ||
- `about/team/nikola-tesla.de.rst` | ||
- `about/team/roberto-alsina.de.rst` | ||
|
||
* `about.de.rst` | ||
* `about/company.de.rst` | ||
* `about/team.de.rst` | ||
* `about/team/nikola-tesla.de.rst` | ||
* `about/team/roberto-alsina.de.rst` | ||
|
||
and use the `slug` meta data (`.. slug: xxx`) to specify the German slug, | ||
Nikola will place the German output files so that the translations are | ||
available under the desired URLs! | ||
|
||
If you use plain Nikola instead, the URLs would be: | ||
- `https://example.com/de/ueber/` | ||
- `https://example.com/de/about/firma/` | ||
- `https://example.com/de/about/mitarbeiter/` | ||
- `https://example.com/de/about/team/nikola-tesla/` | ||
- `https://example.com/de/about/team/roberto-alsina/` | ||
|
||
Note that this plugin requires Nikola 7.8.2. In case version 7.8.2 wasn't | ||
released yet, please use the current master. This plugin requires | ||
[PR 2502](https://github.com/getnikola/nikola/pull/2502) to work. | ||
|
||
* `https://example.com/de/ueber/` | ||
* `https://example.com/de/about/firma/` | ||
* `https://example.com/de/about/mitarbeiter/` | ||
* `https://example.com/de/about/team/nikola-tesla/` | ||
* `https://example.com/de/about/team/roberto-alsina/` | ||
|
||
Note that this plugin requires Nikola 7.8.2 or newer. |