diff --git a/content/docs/api/db/obj/url-to/contents.lr b/content/docs/api/db/obj/url-to/contents.lr index 90f33542..b6dd5d1c 100644 --- a/content/docs/api/db/obj/url-to/contents.lr +++ b/content/docs/api/db/obj/url-to/contents.lr @@ -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 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. diff --git a/content/docs/api/db/types/markdown/contents.lr b/content/docs/api/db/types/markdown/contents.lr index f9f26701..338a7aa5 100644 --- a/content/docs/api/db/types/markdown/contents.lr +++ b/content/docs/api/db/types/markdown/contents.lr @@ -70,3 +70,11 @@ label = Body type = markdown 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). +```