add hiddenPage param

with this param set to true, every effort is made to make the page 'undiscoverable'
This commit is contained in:
Aniket Teredesai 2023-04-07 13:49:54 +05:30
parent cf94a9976d
commit 6e1b938d43
7 changed files with 15 additions and 10 deletions

View File

@ -0,0 +1 @@
<a href="{{ .Destination | safeURL }}" {{ with .Title }}title="{{ . }}"{{ end }} {{ if strings.HasPrefix .Destination "http" | and (.Page.Params.hiddenPage | in (slice true "true")) }}target="_blank" rel="nofollow noopener noreferrer"{{ end }}>{{ .Text | safeHTML }}</a>

View File

@ -12,7 +12,8 @@
{{ if .IsHome }} {{ if .IsHome }}
{{ $PageContext = .Site }} {{ $PageContext = .Site }}
{{ end }} {{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }} {{ $pages := where $PageContext.RegularPages "Type" $contentTypeName }}
{{ $paginator := .Paginate ( ( $pages | symdiff (where $pages "Params.hiddenPage" "==" "true")) | symdiff (where $pages "Params.hiddenPage" "==" true) ) }}
{{ range $paginator.Pages }} {{ range $paginator.Pages }}
<article class="post on-list"> <article class="post on-list">

View File

@ -5,7 +5,8 @@
</div> </div>
{{ end }} {{ end }}
<div class="posts"> <div class="posts">
{{ range .Paginator.Pages }} {{ $paginator := .Paginate ( (.Pages | symdiff (where .Pages "Params.hiddenPage" "==" "true")) | symdiff (where .Pages "Params.hiddenPage" true) ) }}
{{ range $paginator.Pages }}
<article class="post on-list"> <article class="post on-list">
<h1 class="post-title"> <h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a> <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>

View File

@ -10,6 +10,7 @@
{{- if ge $limit 1 -}} {{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}} {{- $pages = $pages | first $limit -}}
{{- end -}} {{- end -}}
{{- $pages = ($pages | symdiff (where $pages "Params.hiddenPage" "==" "true")) | symdiff (where $pages "Params.hiddenPage" true) -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>

View File

@ -1,7 +1,7 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<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 (.Pages | symdiff (where .Pages "Params.hiddenPage" "==" "true")) | symdiff (where .Pages "Params.hiddenPage" true) }}
{{- if .Permalink -}} {{- if .Permalink -}}
<url> <url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}

View File

@ -3,15 +3,18 @@
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
<ul> <ul>
{{ $type := .Type }} {{ $type := .Type }}
{{ range $key, $value := .Data.Terms.Alphabetical }} {{ range $term := .Data.Terms.Alphabetical }}
{{ $name := .Name }} {{ $termPages := (.Pages | symdiff (where .Pages "Params.hiddenPage" "==" "true")) | symdiff (where .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 class="terms-title" href="{{ .Permalink }}">{{ .Name }} ({{ $count }})</a> <a class="terms-title" href="{{ .Permalink }}">{{ .Name }} ({{ $count }})</a>
</li> </li>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
</ul> </ul>
</div> </div>
{{ end }} {{ end }}

View File

@ -2,10 +2,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ if .IsHome }}{{ $.Site.Params.Subtitle }}{{ else if .Description}}{{ .Description | plainify }}{{ else }}{{ .Summary | plainify }}{{ end }}" /> <meta name="description" content="{{ if .IsHome }}{{ $.Site.Params.Subtitle }}{{ else if .Description}}{{ .Description | plainify }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<meta name="keywords" content="{{ with .Params.Keywords }}{{ delimit . ", " }}{{ else }}{{ $.Site.Params.Keywords }}{{ end }}" /> <meta name="keywords" content="{{ with .Params.Keywords }}{{ delimit . ", " }}{{ else }}{{ $.Site.Params.Keywords }}{{ end }}" />
{{ if .Params.noindex }} {{ if .Params.hiddenPage | or .Params.noindex | in (slice "true" true) }}
{{ if or (eq (.Param "noindex") true) (eq (.Param "noindex") "true") }} <meta name="robots" content="noindex,nofollow" />
<meta name="robots" content="noindex" />
{{ end }}
{{ else }} {{ else }}
<meta name="robots" content="noodp" /> <meta name="robots" content="noodp" />
{{ end }} {{ end }}