Sites.md - hugo - [fork] hugo port for 9front
(HTM) git clone https://git.drkhsh.at/hugo.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
Sites.md (1417B)
---
1 ---
2 title: Sites
3 description: Returns a collection of all Site objects, one for each language, ordered by language weight.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 returnType: page.Sites
9 signatures: [PAGE.Sites]
10 ---
11
12 This is a convenience method to access `.Site.Sites`.
13
14 With this site configuration:
15
16 {{< code-toggle file=hugo >}}
17 defaultContentLanguage = 'de'
18 defaultContentLanguageInSubdir = false
19
20 [languages.de]
21 languageCode = 'de-DE'
22 languageDirection = 'ltr'
23 languageName = 'Deutsch'
24 title = 'Projekt Dokumentation'
25 weight = 1
26
27 [languages.en]
28 languageCode = 'en-US'
29 languageDirection = 'ltr'
30 languageName = 'English'
31 title = 'Project Documentation'
32 weight = 2
33 {{< /code-toggle >}}
34
35 This template:
36
37 ```go-html-template
38 <ul>
39 {{ range .Sites }}
40 <li><a href="{{ .Home.Permalink }}">{{ .Title }}</a></li>
41 {{ end }}
42 </ul>
43 ```
44
45 Produces a list of links to each home page:
46
47 ```html
48 <ul>
49 <li><a href="https://example.org/de/">Projekt Dokumentation</a></li>
50 <li><a href="https://example.org/en/">Project Documentation</a></li>
51 </ul>
52 ```
53
54 To render a link to the home page of the site corresponding to the default content language:
55
56 ```go-html-template
57 {{ with .Sites.Default }}
58 <a href="{{ .Home.Permalink }}">{{ .Title }}</a>
59 {{ end }}
60 ```
61
62 This is equivalent to:
63
64 ```go-html-template
65 {{ with index .Sites 0 }}
66 <a href="{{ .Home.Permalink }}">{{ .Title }}</a>
67 {{ end }}
68 ```