Add notes on passing alt in query arg when resolving links

This commit is contained in:
Jeff Dairiki 2022-02-26 21:08:58 -08:00
parent df446238ed
commit 9f663a43fa
2 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,10 @@ the path fails, then the path is interpreted as a URL-path, or, if
If the path starts with a leading bang (``!``) then no resolving is If the path starts with a leading bang (``!``) then no resolving is
performed. This is equivalent to passing `resolve=False`. performed. This is equivalent to passing `resolve=False`.
An explicit value for `alt` may be specified via the `alt` parameter to `url_to`.
Alternatively, an `alt` query arg may be included in the `path` parameter.
For example, `src.url_to('/', alt='de')` is equivalent to `src.url_to('/?alt=de')` — both return the URL to the root of the site with `alt=de`.
If no `alt` is provided the `alt` of the page is used. If no `alt` is provided the `alt` of the page is used.

View File

@ -70,3 +70,11 @@ label = Body
type = markdown type = markdown
resolve_links = never resolve_links = never
``` ```
## Linking to a Specific Alt
When links are resolved through the Lektor database, URLs to specific _alt_s may be obtained by adding an `alt` query arg to the link.
For example, to link to the current page, but in the German alt:
```md
Here is the [French version of the blog](/blog?alt=fr).
```