{{ $p1 := .p1.Parent }}
{{ $p2 := .p2.Parent }}
{{ $home := .home }}

{{- if $home -}}
<div class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
{{- else -}}
<div class="breadcrumb">
{{- end -}}
{{ template "breadcrumbnav" (dict "p1" $p1 "p2" $p2 "home" $home) }}
</div>

{{ define "breadcrumbnav" }}
{{- if .p1.Parent -}}
{{- template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 ) -}}
{{- else if not .p1.IsHome -}}
{{- template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) -}}
{