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 }} {{- end }}
</header> </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 }} {{- if site.Params.ShowAllPagesInArchive }}
{{- $pages = site.RegularPages }} {{- $pages = site.RegularPages }}

View File

@ -1,6 +1,6 @@
{{- $.Scratch.Add "index" slice -}} {{- $.Scratch.Add "index" slice -}}
{{- range site.RegularPages -}} {{- 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) -}} {{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary) -}}
{{- end }} {{- end }}
{{- end -}} {{- end -}}

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"> xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }} {{ range .Data.Pages }}
{{- if .Permalink -}} {{- if .Permalink | and (ne .Params.hiddenPage true) -}}
<url> <url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }} <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"> <ul class="terms-tags">
{{- $type := .Type }} {{- $type := .Type }}
{{- range $key, $value := .Data.Terms.Alphabetical }} {{- range $term := .Data.Terms.Alphabetical }}
{{- $name := .Name }} {{- $termPages := where $term.Pages "Params.hiddenPage" "!=" "true" }}
{{- $count := .Count }} {{- if (len $termPages | ne 0) }}
{{- $name := $term.Name }}
{{- $count := len $termPages }}
{{- with site.GetPage (printf "/%s/%s" $type $name) }} {{- with site.GetPage (printf "/%s/%s" $type $name) }}
<li> <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> </li>
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}
</ul> </ul>
{{- end }}{{/* end main */ -}} {{- end }}{{/* end main */ -}}