mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 02:40:24 +00:00
theme: harmonize querying hiddenstem #891
This commit is contained in:
parent
20136aa4e7
commit
a7d090b667
10 changed files with 16 additions and 18 deletions
|
@ -2,7 +2,7 @@
|
|||
{{- $pages := slice }}
|
||||
{{- range .Site.Pages }}
|
||||
{{- if partial "_relearn/pageIsSpecial.gotmpl" . }}
|
||||
{{- else if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }}
|
||||
{{- else if and .Title .RelPermalink (or (ne .Site.Params.disableSearchHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) }}
|
||||
{{- $tags := slice }}
|
||||
{{- range .GetTerms "tags" }}
|
||||
{{- $tags = $tags | append (partial "title.gotmpl" (dict "page" .Page "linkTitle" true) | plainify) }}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{- partialCached "relearn-meta.gotmpl" . .Path }}
|
||||
{{- .Store.Set "relearnOutputFormat" "notfound" -}}
|
||||
{{- partialCached "relearn-meta.gotmpl" . .Path -}}
|
||||
<!DOCTYPE html>
|
||||
{{- .Store.Set "relearnOutputFormat" "notfound" }}
|
||||
<html lang="{{ .Page.Language.LanguageCode }}" dir="{{ .Page.Language.LanguageDirection | default (T "Reading-direction") | default "ltr" }}" itemscope itemtype="http://schema.org/Article">
|
||||
<head>
|
||||
{{- partial "meta.html" . }}
|
||||
|
|
|
@ -27,16 +27,13 @@
|
|||
{{- end }}
|
||||
|
||||
{{- /* output formats */}}
|
||||
{{- if not (and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }}
|
||||
{{- else }}
|
||||
{{- $page := . }}
|
||||
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
|
||||
{{- range .AlternativeOutputFormats }}
|
||||
{{- if eq .Rel "canonical" }}
|
||||
{{- $page := . }}
|
||||
{{- $link := "<link href=\"%s\" rel=\"%s\" type=\"%s\" title=\"%s\">" }}
|
||||
{{- range .AlternativeOutputFormats }}
|
||||
{{- if eq .Rel "canonical" }}
|
||||
{{ (printf $link (partial "permalink.gotmpl" (dict "to" . "abs" true)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
|
||||
{{- else if not (partial "_relearn/pageIsSpecial.gotmpl" $page) }}
|
||||
{{- else if not (partial "_relearn/pageIsSpecial.gotmpl" $page) }}
|
||||
{{ (printf $link (partial "permalink.gotmpl" (dict "to" .)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- partialCached "favicon.html" . }}
|
||||
|
|
|
@ -41,13 +41,12 @@
|
|||
{{- end }}
|
||||
{{- range $pages }}
|
||||
{{- $visible := true }}
|
||||
{{- $relearnIsHiddenFrom := index ($page.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }}
|
||||
{{- if partial "_relearn/pageIsSpecial.gotmpl" . }}
|
||||
{{- $visible = false }}
|
||||
{{- else if or (eq .Kind "taxonomy") (eq .Kind "term") }}
|
||||
{{- $visible = and .Title .Permalink (or (not $relearnIsHiddenFrom) (ne .Site.Params.disableTagHiddenPages true) ) }}
|
||||
{{- $visible = and .Title .Permalink (or (ne .Site.Params.disableTagHiddenPages true) (not (partialCached "_relearn/pageIsHidden.gotmpl" . .Path) ) ) }}
|
||||
{{- else }}
|
||||
{{- $visible = and .Title .Permalink (or (not $relearnIsHiddenFrom) (ne .Site.Params.disableSeoHiddenPages true) ) }}
|
||||
{{- $visible = and .Title .Permalink (or (ne .Site.Params.disableSeoHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" $page) .Path $page.Path) ) ) }}
|
||||
{{- end }}
|
||||
{{- if $visible }}
|
||||
<item>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
{{- range where .Pages "Sitemap.Disable" "ne" true }}
|
||||
{{- if partial "_relearn/pageIsSpecial.gotmpl" . }}
|
||||
{{- else if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) }}
|
||||
{{- else if and .Title .RelPermalink (or (ne .Site.Params.disableSeoHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) }}
|
||||
<url>
|
||||
<loc>{{ partial "permalink.gotmpl" (dict "to" . "abs" true) }}</loc>{{ if not .Lastmod.IsZero }}
|
||||
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
|
||||
|
|
1
layouts/partials/_relearn/pageIsHidden.gotmpl
Normal file
1
layouts/partials/_relearn/pageIsHidden.gotmpl
Normal file
|
@ -0,0 +1 @@
|
|||
{{- return .Scratch.Get "relearnIsHiddenNode" }}
|
|
@ -0,0 +1 @@
|
|||
{{- return .Scratch.Get "relearnIsHiddenStem" }}
|
|
@ -3,7 +3,7 @@
|
|||
{{- $count := 0 }}
|
||||
{{- range .Pages }}
|
||||
{{- /* count pages of term */}}
|
||||
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }}
|
||||
{{- if and .Title .RelPermalink (or (ne .Site.Params.disableTagHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) }}
|
||||
{{- $count = add $count 1 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{- $pages := slice }}
|
||||
{{- range .Pages }}
|
||||
{{- if and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableTagHiddenPages true) ) }}
|
||||
{{- if and .Title .RelPermalink (or (ne .Site.Params.disableTagHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) }}
|
||||
{{- $pages = $pages | append (dict "Title" .Title "Page" . )}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
{{- $ver := printf "<meta name=\"generator\" content=\"%s %s\">" "Relearn" $ver }}
|
||||
{{ $ver | safeHTML }}
|
||||
{{- end }}
|
||||
{{- if not (and .Title .RelPermalink (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) ) }}
|
||||
{{- if not (and .Title .RelPermalink (or (ne .Site.Params.disableSeoHiddenPages true) (not (partialCached "_relearn/pageIsHiddenSelfOrAncestor.gotmpl" (dict "page" . "to" .Site.Home) .Path .Site.Home.Path) ) ) ) }}
|
||||
<meta name="robots" content="noindex, nofollow, noarchive, noimageindex">
|
||||
{{- end }}
|
||||
<meta name="description" content="{{ with trim (or .Description .Summary | plainify | htmlUnescape) "\n\r\t " }}{{ . }}{{ end }}">
|
||||
|
|
Loading…
Reference in a new issue