diff options
author | otis <xiaohei.zyx@gmail.com> | 2020-01-02 05:10:17 +0300 |
---|---|---|
committer | otis <xiaohei.zyx@gmail.com> | 2020-01-02 05:10:17 +0300 |
commit | fc06d37f9dd5d37b647f0306f00b2f18df562768 (patch) | |
tree | 67cdb8253dbabc7dd871904b76c3eb329bc75864 | |
parent | b917696abcb8c54d9ce58e9f663cb428e3d21401 (diff) |
fix: show pages in main section directory
-rw-r--r-- | layouts/_default/baseof.html | 5 | ||||
-rw-r--r-- | layouts/_default/list.html | 5 | ||||
-rw-r--r-- | layouts/index.html | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 05b0d70..8088892 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -26,7 +26,12 @@ {{- if eq .Site.Params.sidebar "none"}} {{- $.Scratch.Add "bodyClass" "no-sidebar" }} {{- end }} + <!-- gen regular pages by mainSections --> + <!-- if exists, delete it --> + {{- if ($.Scratch.Get "pages") }} + {{- $.Scratch.Delete "pages"}} + {{- end}} {{- if and (.Site.Params.mainSections) (ge (len .Site.Params.mainSections) 0) }} {{- $.Scratch.Add "pages" (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }} {{- else }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index a318be3..ae562fa 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,14 +1,15 @@ {{- define "content"}} +{{$pages := $.Scratch.Get "pages"}} <main class="main" role="main"> <article class="content article article-archives article-type-list" itemscope=""> <header class="article-header"> <h1 itemprop="title">{{ .Title }}</h1> - <p class="text-muted">{{- T "total_article" (len .Site.RegularPages) }}</p> + <p class="text-muted">{{- T "total_article" (len $pages) }}</p> </header> <div class="article-body"> {{- $emptyDatePages := slice}} {{- $currentYearSection := 0}} - {{- range $idx,$page := .Site.RegularPages}} + {{- range $idx,$page := $pages}} {{- if $page.Date}} {{- $thisYear := $page.Date.Format ("2006") }} {{- if eq $currentYearSection 0 }} diff --git a/layouts/index.html b/layouts/index.html index 0a8197c..69bf2b6 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -4,7 +4,7 @@ {{/* partial "archive-list.html" . - */}} <div class="content article-list"> <!-- {{- print ($.Scratch.Get "pages") }} --> - {{ $paginator := .Paginate .Site.RegularPages }} + {{ $paginator := .Paginate ($.Scratch.Get "pages") }} {{ range $paginator.Pages }} <article class="article article-type-page" |