exclude pages marked as hiddenPage

This commit is contained in:
Aniket Teredesai 2023-02-18 17:07:02 +05:30
parent 1f7ff80687
commit f8aedf20e6
6 changed files with 12 additions and 8 deletions

View File

@ -9,7 +9,7 @@
{{- end }}
</header>
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- $pages := where (where site.RegularPages "Type" "in" site.Params.mainSections) "Params.hiddenPage" "!=" "true" }}
{{- if site.Params.ShowAllPagesInArchive }}
{{- $pages = site.RegularPages }}

View File

@ -1,6 +1,6 @@
{{- $.Scratch.Add "index" slice -}}
{{- range site.RegularPages -}}
{{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) }}
{{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) (ne .Params.hiddenPage true) }}
{{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}}
{{- end }}
{{- end -}}

View File

@ -42,6 +42,7 @@
{{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- $pages = where $pages "Params.hiddenInHomeList" "!=" "true" }}
{{- end }}
{{- $pages = where $pages "Params.hiddenPage" "!=" "true" }}
{{- $paginator := .Paginate $pages }}

View File

@ -33,7 +33,7 @@
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range $pages }}
{{- if and (ne .Layout `search`) (ne .Layout `archives`) }}
{{- if and (ne .Layout `search`) (ne .Layout `archives`) (ne .Params.hiddenPage true) }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>

View File

@ -2,7 +2,7 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
{{- if .Permalink -}}
{{- if .Permalink | and (ne .Params.hiddenPage true) -}}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}

View File

@ -13,15 +13,18 @@
<ul class="terms-tags">
{{- $type := .Type }}
{{- range $key, $value := .Data.Terms.Alphabetical }}
{{- $name := .Name }}
{{- $count := .Count }}
{{- range $term := .Data.Terms.Alphabetical }}
{{- $termPages := where $term.Pages "Params.hiddenPage" "!=" "true" }}
{{- if (len $termPages | ne 0) }}
{{- $name := $term.Name }}
{{- $count := len $termPages }}
{{- with site.GetPage (printf "/%s/%s" $type $name) }}
<li>
<a href="{{ .Permalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a>
<a href="{{ .Permalink }}">{{ $name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a>
</li>
{{- end }}
{{- end }}
{{- end }}
</ul>
{{- end }}{{/* end main */ -}}