breadcrumb: hide unpublished pages #185

This commit is contained in:
Sören Weber 2022-02-17 14:19:34 +01:00
parent 92cd36c2b6
commit 7c1d85558d
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
3 changed files with 11 additions and 5 deletions

View file

@ -1,9 +1,9 @@
+++
title = "More"
[_build]
render = "always"
render = "never"
list = "never"
publishResources = true
publishResources = false
+++
{{%children containerstyle="div" style="h2" description="true" %}}

View file

@ -1,8 +1,8 @@
+++
title = "Morrre"
[_build]
render = "always"
render = "never"
list = "never"
publishResources = true
publishResources = false
+++
{{< piratify >}}

View file

@ -85,9 +85,15 @@
{{- define "breadcrumb" }}
{{- $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 }}
{{- template "breadcrumb" dict "page" $parent "depth" $depth }}
{{- 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>
{{- end }}
{{- end }}