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 authored and Aditya Telange committed 2020-09-12 09:57:30 +05:30
1 parent 75d5acc15d
commit ab14f2f275
2 files changed
+12 -12

No files matched your search

+2 -2
View File
@@ -2,8 +2,8 @@
<div class="archive">
<header class="page-header"><h1>{{ .Title }}</h1></header>
{{ range .Site.RegularPages.GroupByPublishDate "2006" }}
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ range $pages.GroupByPublishDate "2006" }}
{{ if ne .Key "0001" }}
<div class="archive-year">
<h2 class="archive-year-header">{{ replace .Key "0001" "" }}</h2>
+10 -10
View File
@@ -4,20 +4,20 @@
{{- partial "indexProfile.html" . }}
{{else}} {{/* if not profileMode */}}
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
{{ $PageContext := . }}
{{ if .IsHome }}
{{ $PageContext = .Site }}
{{else}}
{{- if .Title }}
{{- if not .IsHome | and .Title }}
<header class="page-header">
<h1>{{ .Title }}</h1>
</header>
{{ 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 }}