source: tanzpartie-hugo/themes/bilberry-hugo-theme/layouts/index.json @ 17397

Last change on this file since 17397 was 16971, checked in by Henrik Bettermann, 2 years ago
File size: 2.6 KB
RevLine 
[16971]1{{- $.Scratch.Add "index" slice -}}
2
3{{- range $name, $taxonomy := .Site.Taxonomies.categories -}}
4    {{- $.Scratch.Add "index" (dict "url" (print "/categories/" $name | absURL) "title" ($name | humanize) "iconClass" "fa-folder" "type" "category" "objectID" (print "/categories/" $name | absURL) ) -}}
5{{- end -}}
6
7{{- range $name, $taxonomy := .Site.Taxonomies.author -}}
8    {{- $author_name := $name -}}
9    {{- $author_path := (printf "/author/%s" (urlize $name)) -}}
10    {{- $author_page := site.GetPage $author_path -}}
11    {{- if $author_page -}}
12        {{- $author_name = $author_page.Title -}}
13    {{- end -}}
14    {{- $.Scratch.Add "index" (dict "url" ($author_path | absURL) "title" $author_name "iconClass" "fa-user" "type" "author" "objectID" ($author_path | absURL) ) -}}
15{{- end -}}
16
17{{- range $name, $taxonomy := .Site.Taxonomies.tags -}}
18    {{- $.Scratch.Add "index" (dict "url" (print "/tags/" $name | absURL) "title" ($name | humanize) "iconClass" "fa-tag" "type" "tag" "objectID" (print "/tags/" $name | absURL) ) -}}
19{{- end -}}
20
21{{- range $name, $taxonomy := .Site.Taxonomies.series -}}
22    {{- $.Scratch.Add "index" (dict "url" (print "/series/" $name | absURL) "title" ($name | humanize) "iconClass" "fa-list-alt" "type" "series" "objectID" (print "/series/" $name | absURL) ) -}}
23{{- end -}}
24
25{{- range where .Site.RegularPages "Type" "not in" (slice "page" "json" "status") -}}
26    {{- $iconClass := "" -}}
27    {{- if and (isset .Params "icon") (ne .Params.icon "") -}}
28        {{- $iconClass = .Params.icon -}}
29    {{- else if eq .Type "quote" -}}
30        {{- $iconClass = "fa-quote-right" -}}
31    {{- else if eq .Type "link" -}}
32        {{- $iconClass = "fa-link" -}}
33    {{- else if eq .Type "video" -}}
34        {{- $iconClass = "fa-video" -}}
35    {{- else if or (eq .Type "gallery") (eq .Type "picture") -}}
36        {{- $iconClass = "fa-camera" -}}
37    {{- else if eq .Type "audio" -}}
38        {{- $iconClass = "fa-music" -}}
39    {{- else if eq .Type "code" -}}
40        {{- $iconClass = "fa-code" -}}
41    {{- else -}}
42        {{-  $iconClass = "fa-pencil-alt" -}}
43    {{- end -}}
44
45    {{- range .Translations -}}
46        {{- $.Scratch.Add "index" (dict "url" .Permalink "title" .Title "tags" .Params.tags "categories" .Params.categories "author" .Params.author "type" .Type "language" .Lang "iconClass" $iconClass "objectID" (.Permalink | md5) ) -}}
47    {{- end -}}
48    {{- $.Scratch.Add "index" (dict "url" .Permalink "title" .Title "tags" .Params.tags "categories" .Params.categories "author" .Params.author "type" .Type "language" .Lang "iconClass" $iconClass "objectID" (.Permalink | md5) ) -}}
49
50{{- end -}}
51
52{{- $.Scratch.Get "index" | jsonify -}}
Note: See TracBrowser for help on using the repository browser.