Debian Codegraph @

docs/content/en/methods/page/RelRef.md

raw
1 ---
2 title: RelRef
3 description: Returns the relative URL of the page with the given path, language, and output format.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: string
9 signatures: [PAGE.RelRef OPTIONS]
10 ---
11
12 ## Usage
13
14 The `RelRef` method requires a single argument: an options map.
15
16 ## Options
17
18 {{% include "_common/ref-and-relref-options.md" %}}
19
20 ## Examples
21
22 The following examples show the rendered output for a page on the English version of the site:
23
24 ```go-html-template
25 {{ $opts := dict "path" "/books/book-1" }}
26 {{ .RelRef $opts }} → /en/books/book-1/
27
28 {{ $opts := dict "path" "/books/book-1" "lang" "de" }}
29 {{ .RelRef $opts }} → /de/books/book-1/
30
31 {{ $opts := dict "path" "/books/book-1" "lang" "de" "outputFormat" "json" }}
32 {{ .RelRef $opts }} → /de/books/book-1/index.json
33 ```
34
35 ## Error handling
36
37 {{% include "_common/ref-and-relref-error-handling.md" %}}