diff options
Diffstat (limited to 'layouts/partials/GetSections.html')
| -rw-r--r-- | layouts/partials/GetSections.html | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/layouts/partials/GetSections.html b/layouts/partials/GetSections.html deleted file mode 100644 index 393791d..0000000 --- a/layouts/partials/GetSections.html +++ /dev/null @@ -1,79 +0,0 @@ -{{- $page := .page -}} -{{- $loading := .loading -}} - -{{/* Add title for current page */}} -{{- $items := slice -}} -{{ $items = $items | append (dict "title" $page.Title "content" "" )}} - -{{/* Identify page sections */}} -{{- $sections := slice -}} -{{- $sections = $sections | append $page.Type -}} -{{ with $page.Params.sections }} - {{ $sections = $sections | append . }} -{{ end }} - -{{ if $page.IsHome }} - {{- if not $page.Params.sections -}} - {{- with site.Params.home.sections }} - {{ $sections = $sections | append . }} - {{ else }} - {{ range $section := site.Sections }} - {{ $sections = $sections | append $section.Type }} - {{ end }} - {{ end }} - {{- end -}} -{{ end }} - -{{/* Generate title and content for each section */}} -{{- range $index, $section := $sections -}} - {{- $sectionPage := site.GetPage "section" $section -}} - {{- $sectionURL := $sectionPage.RelPermalink -}} - {{ with $sectionPage.Params.redirect}} - {{ $target := partial "utilities/GetPage.html" (dict "url" . "page" $page) }} - {{- if not $target -}} - {{ if eq (printf "%T" $page.File) "*hugolib.fileInfo"}} - {{- errorf "Cannot find redirect target on page '%s': %s" $page.File . -}} - {{ else }} - {{- errorf "Cannot find redirect target: %s" . -}} - {{ end }} - {{ else }} - {{- $sectionURL = $target.RelPermalink -}} - {{ end }} - {{ end }} - {{- $title := or $sectionPage.Title $sectionPage.Type -}} - - {{- with (index site.Params.sections $section) -}} - {{- with index . "title" }}{{ $title = or . $title }}{{ end -}} - {{- end -}} - - {{- $thumbnail := "" -}} - {{ if reflect.IsMap $sectionPage.Params.Thumbnail }}{{ $thumbnail = $sectionPage.Params.Thumbnail.url }}{{ else }}{{ $thumbnail = $sectionPage.Params.Thumbnail }}{{ end }} - {{- $icon := $sectionPage.Params.Icon -}} - {{- $content := "" -}} - {{ if not $sectionPage.IsSection }}{{ $content = $sectionPage.Content }}{{ end -}} - {{- $sectionTitle := strings.FirstUpper $sectionPage.Type -}} - {{- $moreTitle := "" -}} - {{- with (index site.Params.sections $section) -}} - {{- with index . "reference" }}{{ $moreTitle = . }}{{ end -}} - {{- end -}} - {{- $moreTitle = or $moreTitle (printf (T "more" (pluralize $sectionTitle))) -}} - - {{- $sectionContent := trim (partial "assets/section-list.html" (dict - "page" $page - "section" $section - "home" $page.IsHome - "simple" (eq (len $sections) 1) - "thumbnail" $thumbnail - "icon" $icon - "content" $content - "moreTitle" $moreTitle - "sectionURL" $sectionURL - "loading" $loading)) " \r\n" - -}} - - {{ if $sectionContent }} - {{ $items = $items | append (dict "title" $title "content" $sectionContent)}} - {{ end }} -{{- end -}} - -{{ return $items }}
\ No newline at end of file |
