mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-02-17 09:10:08 +00:00
breadcrumb: hide unpublished pages #185
This commit is contained in:
parent
92cd36c2b6
commit
7c1d85558d
3 changed files with 11 additions and 5 deletions
|
@ -1,9 +1,9 @@
|
||||||
+++
|
+++
|
||||||
title = "More"
|
title = "More"
|
||||||
[_build]
|
[_build]
|
||||||
render = "always"
|
render = "never"
|
||||||
list = "never"
|
list = "never"
|
||||||
publishResources = true
|
publishResources = false
|
||||||
+++
|
+++
|
||||||
|
|
||||||
{{%children containerstyle="div" style="h2" description="true" %}}
|
{{%children containerstyle="div" style="h2" description="true" %}}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
+++
|
+++
|
||||||
title = "Morrre"
|
title = "Morrre"
|
||||||
[_build]
|
[_build]
|
||||||
render = "always"
|
render = "never"
|
||||||
list = "never"
|
list = "never"
|
||||||
publishResources = true
|
publishResources = false
|
||||||
+++
|
+++
|
||||||
{{< piratify >}}
|
{{< piratify >}}
|
|
@ -85,9 +85,15 @@
|
||||||
|
|
||||||
{{- define "breadcrumb" }}
|
{{- define "breadcrumb" }}
|
||||||
{{- $parent := .page.Parent }}
|
{{- $parent := .page.Parent }}
|
||||||
{{- $depth := add .depth 1 }}
|
{{- $ispublished := gt (int (len .page.Permalink)) 0 }}
|
||||||
|
{{- $depth := .depth }}
|
||||||
|
{{- if $ispublished }}
|
||||||
|
{{- $depth = add $depth 1 }}
|
||||||
|
{{- end }}
|
||||||
{{- if $parent }}
|
{{- if $parent }}
|
||||||
{{- template "breadcrumb" dict "page" $parent "depth" $depth }}
|
{{- template "breadcrumb" dict "page" $parent "depth" $depth }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if $ispublished }}
|
||||||
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"><meta itemprop="position" content="{{ $depth }}" /><a itemprop="item" href="{{ .page.RelPermalink }}"{{if not .depth}} aria-disabled="true"{{end}}><span itemprop="name">{{ .page.Title }}</span></a>{{ if .depth }} > {{ end }}</li>
|
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement"><meta itemprop="position" content="{{ $depth }}" /><a itemprop="item" href="{{ .page.RelPermalink }}"{{if not .depth}} aria-disabled="true"{{end}}><span itemprop="name">{{ .page.Title }}</span></a>{{ if .depth }} > {{ end }}</li>
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
Loading…
Add table
Reference in a new issue