mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +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"
|
||||
[_build]
|
||||
render = "always"
|
||||
render = "never"
|
||||
list = "never"
|
||||
publishResources = true
|
||||
publishResources = false
|
||||
+++
|
||||
|
||||
{{%children containerstyle="div" style="h2" description="true" %}}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
+++
|
||||
title = "Morrre"
|
||||
[_build]
|
||||
render = "always"
|
||||
render = "never"
|
||||
list = "never"
|
||||
publishResources = true
|
||||
publishResources = false
|
||||
+++
|
||||
{{< piratify >}}
|
|
@ -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 }}
|
Loading…
Reference in a new issue