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 }}
{{ $PageContext = .Site }}
{{ 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 }}
<article class="post on-list">

View File

@ -5,7 +5,8 @@
</div>
{{ end }}
<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">
<h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>

View File

@ -10,6 +10,7 @@
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- 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 }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>

View File

@ -1,7 +1,7 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
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 -}}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}

View File

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

View File

@ -2,10 +2,8 @@
<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="keywords" content="{{ with .Params.Keywords }}{{ delimit . ", " }}{{ else }}{{ $.Site.Params.Keywords }}{{ end }}" />
{{ if .Params.noindex }}
{{ if or (eq (.Param "noindex") true) (eq (.Param "noindex") "true") }}
<meta name="robots" content="noindex" />
{{ end }}
{{ if .Params.hiddenPage | or .Params.noindex | in (slice "true" true) }}
<meta name="robots" content="noindex,nofollow" />
{{ else }}
<meta name="robots" content="noodp" />
{{ end }}