mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-27 04:03:48 +01:00
refactor: drop support for hidden
field in front matter
This commit is contained in:
parent
6e5956b905
commit
e5f3cb11d5
8 changed files with 8 additions and 23 deletions
|
@ -5,7 +5,6 @@ date: {{ .Date }}
|
|||
image:
|
||||
math:
|
||||
license:
|
||||
hidden: false
|
||||
comments: true
|
||||
draft: true
|
||||
---
|
|
@ -16,10 +16,8 @@
|
|||
</header>
|
||||
|
||||
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
||||
{{ $filtered := ($pages | intersect $notHidden) }}
|
||||
|
||||
{{ range $filtered.GroupByDate "2006" }}
|
||||
|
||||
{{ range $pages.GroupByDate "2006" }}
|
||||
{{ $id := lower (replace .Key " " "-") }}
|
||||
<div class="archives-group" id="{{ $id }}">
|
||||
<h2 class="archives-date section-title"><a href="{{ $.RelPermalink }}#{{ $id }}">{{ .Key }}</a></h2>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
{{- else -}}
|
||||
{{- $pages = $pctx.Pages -}}
|
||||
{{- end -}}
|
||||
{{- $pages := where $pages "Params.hidden" "!=" true -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
{{ define "main" }}
|
||||
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
|
||||
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
||||
{{ $filtered := ($pages | intersect $notHidden) }}
|
||||
{{ $pag := .Paginate ($filtered) }}
|
||||
|
||||
{{ $pag := .Paginate ($pages) }}
|
||||
<section class="article-list">
|
||||
{{ range $index, $element := $pag.Pages }}
|
||||
{{ partial "article-list/default" . }}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
|
||||
{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}}
|
||||
{{- $filtered := ($pages | intersect $notHidden) -}}
|
||||
|
||||
{{- $result := slice -}}
|
||||
|
||||
{{- range $filtered -}}
|
||||
{{- range $pages -}}
|
||||
{{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}}
|
||||
|
||||
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{{ $related := (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | first 5 }}
|
||||
{{ $related := .Site.RegularPages.Related . | first 5 }}
|
||||
{{ with $related }}
|
||||
<aside class="related-content--wrapper">
|
||||
<h2 class="section-title">{{ T "article.relatedContent" }}</h2>
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
<!-- Build paginator -->
|
||||
{{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
|
||||
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
|
||||
{{ $filtered := ($pages | intersect $notHidden) }}
|
||||
{{ $pag := .Paginate ($filtered) }}
|
||||
{{ $pag := .Paginate ($pages) }}
|
||||
|
||||
{{ if .Paginator.HasPrev }}
|
||||
<!-- Paginated. Append page number to title -->
|
||||
|
@ -20,8 +18,7 @@
|
|||
<!-- Taxonomy page -->
|
||||
|
||||
<!-- Build paginator -->
|
||||
{{ $notHidden := where .Pages "Params.hidden" "!=" true }}
|
||||
{{ $pag := .Paginate ($notHidden) }}
|
||||
{{ $pag := .Paginate .Pages }}
|
||||
|
||||
<!-- {TAXONOMY_TYPE}: {TAXONOMY_TERM} -->
|
||||
{{ $title = slice (title .Data.Singular) ": " $title }}
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
<h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2>
|
||||
|
||||
{{ $pages := where $context.Site.RegularPages "Type" "in" $context.Site.Params.mainSections }}
|
||||
{{ $notHidden := where $context.Site.RegularPages "Params.hidden" "!=" true }}
|
||||
{{ $filtered := ($pages | intersect $notHidden) }}
|
||||
{{ $archives := $filtered.GroupByDate "2006" }}
|
||||
{{ $archives := $pages.GroupByDate "2006" }}
|
||||
|
||||
<div class="widget-archive--list">
|
||||
{{ range $index, $item := first (add $limit 1) ($archives) }}
|
||||
|
|
Loading…
Reference in a new issue