Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Cai <github@jimmycai.com>2022-06-12 14:42:35 +0300
committerGitHub <noreply@github.com>2022-06-12 14:42:35 +0300
commite5f3cb11d59773e45aec0c57fb914e73dae211e0 (patch)
tree84c9f701aff509ec0e69ffd812f7180b47371bde
parent6e5956b9056e246661782f316726d42f3e1c7356 (diff)
refactor: drop support for `hidden` field in front matter
-rw-r--r--archetypes/default.md1
-rw-r--r--layouts/_default/archives.html6
-rw-r--r--layouts/_default/rss.xml1
-rw-r--r--layouts/index.html5
-rw-r--r--layouts/page/search.json5
-rw-r--r--layouts/partials/article/components/related-content.html2
-rw-r--r--layouts/partials/data/title.html7
-rw-r--r--layouts/partials/widget/archives.html4
8 files changed, 8 insertions, 23 deletions
diff --git a/archetypes/default.md b/archetypes/default.md
index 0556d3a..129dec2 100644
--- a/archetypes/default.md
+++ b/archetypes/default.md
@@ -5,7 +5,6 @@ date: {{ .Date }}
image:
math:
license:
-hidden: false
comments: true
draft: true
--- \ No newline at end of file
diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html
index 5d5243c..9df633e 100644
--- a/layouts/_default/archives.html
+++ b/layouts/_default/archives.html
@@ -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>
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
index e9f3f1a..0d3170e 100644
--- a/layouts/_default/rss.xml
+++ b/layouts/_default/rss.xml
@@ -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 -}}
diff --git a/layouts/index.html b/layouts/index.html
index 0cd0b88..5c1eaa5 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -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" . }}
diff --git a/layouts/page/search.json b/layouts/page/search.json
index 5d4e627..67f4cc6 100644
--- a/layouts/page/search.json
+++ b/layouts/page/search.json
@@ -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" -}}
diff --git a/layouts/partials/article/components/related-content.html b/layouts/partials/article/components/related-content.html
index aba88e3..822fc73 100644
--- a/layouts/partials/article/components/related-content.html
+++ b/layouts/partials/article/components/related-content.html
@@ -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>
diff --git a/layouts/partials/data/title.html b/layouts/partials/data/title.html
index 85a7bc7..938a5da 100644
--- a/layouts/partials/data/title.html
+++ b/layouts/partials/data/title.html
@@ -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 }}
diff --git a/layouts/partials/widget/archives.html b/layouts/partials/widget/archives.html
index 1f2abc5..e42da27 100644
--- a/layouts/partials/widget/archives.html
+++ b/layouts/partials/widget/archives.html
@@ -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) }}