Adapt theme to be compatible with hugoBasicExample

_default/{archives,list}.html utilize .site.Params.mainSections

This flexible option let's users decide what content pages they want to
display in the archive and on the homepage. By default, Hugo adds
content types with the most content files as a good heuristic. Can be
overwritten at any time in the config file.

Signed-off-by: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
This commit is contained in:
Digitalcraftsman 2020-09-11 20:36:58 +02:00 committed by Aditya Telange
parent 75d5acc15d
commit ab14f2f275
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
2 changed files with 12 additions and 12 deletions

View File

@ -2,8 +2,8 @@
<div class="archive"> <div class="archive">
<header class="page-header"><h1>{{ .Title }}</h1></header> <header class="page-header"><h1>{{ .Title }}</h1></header>
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ range .Site.RegularPages.GroupByPublishDate "2006" }} {{ range $pages.GroupByPublishDate "2006" }}
{{ if ne .Key "0001" }} {{ if ne .Key "0001" }}
<div class="archive-year"> <div class="archive-year">
<h2 class="archive-year-header">{{ replace .Key "0001" "" }}</h2> <h2 class="archive-year-header">{{ replace .Key "0001" "" }}</h2>

View File

@ -4,20 +4,20 @@
{{- partial "indexProfile.html" . }} {{- partial "indexProfile.html" . }}
{{else}} {{/* if not profileMode */}} {{else}} {{/* if not profileMode */}}
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }} {{- if not .IsHome | and .Title }}
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
{{ $PageContext := . }}
{{ if .IsHome }}
{{ $PageContext = .Site }}
{{else}}
{{- if .Title }}
<header class="page-header"> <header class="page-header">
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
</header> </header>
{{ end }} {{ end }}
{{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}
{{ $pages := .RegularPages }}
{{ if .IsHome }}
{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{end}}
{{ $paginator := .Paginate $pages }}
{{- range $index, $page := $paginator.Pages }} {{- range $index, $page := $paginator.Pages }}