github.com/square/finch@v0.0.0-20240412205204-6530c03e2b96/docs/themes/hugo-geekdoc/layouts/partials/page-header.html (about) 1 {{ $geekdocRepo := default (default false .Site.Params.GeekdocRepo) .Page.Params.GeekdocRepo }} 2 {{ $geekdocEditPath := default (default false .Site.Params.GeekdocEditPath) .Page.Params.GeekdocEditPath }} 3 {{ if .File }} 4 {{ $.Scratch.Set "geekdocFilePath" (default (path.Join (default "content" .Site.Params.contentDir) .File.Path) .Page.Params.GeekdocFilePath) }} 5 {{ else }} 6 {{ $.Scratch.Set "geekdocFilePath" false }} 7 {{ end }} 8 9 {{ define "breadcrumb" }} 10 {{ $parent := .page.Parent }} 11 {{ if $parent }} 12 {{ $name := (partial "utils/title" $parent) }} 13 {{ $position := (sub .position 1) }} 14 {{ $value := (printf "<li itemprop='itemListElement' itemscope itemtype='https://schema.org/ListItem'><a itemscope itemtype='https://schema.org/WebPage' itemprop='item' itemid='%s' href='%s'><span itemprop='name'>%s</span></a><meta itemprop='position' content='%d' /></li><li> / </li>%s" $parent.RelPermalink $parent.RelPermalink $name $position .value) }} 15 {{ template "breadcrumb" dict "page" $parent "value" $value "position" $position }} 16 {{ else }} 17 {{ .value | safeHTML }} 18 {{ end }} 19 {{ end }} 20 21 {{ $showBreadcrumb := (and (default true .Page.Params.GeekdocBreadcrumb) (default true .Site.Params.GeekdocBreadcrumb)) }} 22 {{ $showEdit := (and ($.Scratch.Get "geekdocFilePath") $geekdocRepo $geekdocEditPath) }} 23 <div 24 class="gdoc-page__header flex flex-wrap 25 {{ if $showBreadcrumb }} 26 justify-between 27 {{ else }} 28 justify-end 29 {{ end }} 30 {{ if not $showEdit }}hidden-mobile{{ end }} 31 {{ if (and (not $showBreadcrumb) (not $showEdit)) }}hidden{{ end }}" 32 itemprop="breadcrumb" 33 > 34 {{ if $showBreadcrumb }} 35 <div> 36 <svg class="gdoc-icon gdoc_path hidden-mobile"><use xlink:href="#gdoc_path"></use></svg> 37 <ol class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList"> 38 {{ $position := sub (len (split .RelPermalink "/")) 1 }} 39 {{ $name := (partial "utils/title" .) }} 40 {{ $value := (printf "<li itemprop='itemListElement' itemscope itemtype='https://schema.org/ListItem'><span itemprop='name'>%s</span><meta itemprop='position' content='%d' /></li>" $name $position ) }} 41 {{ template "breadcrumb" dict "page" . "value" $value "position" $position }} 42 </ol> 43 </div> 44 {{ end }} 45 {{ if $showEdit }} 46 <div> 47 <span class="editpage"> 48 <svg class="gdoc-icon gdoc_code"><use xlink:href="#gdoc_code"></use></svg> 49 <a 50 href="{{ $geekdocRepo }}/{{ path.Join $geekdocEditPath ($.Scratch.Get "geekdocFilePath") }}" 51 > 52 {{ i18n "edit_page" }} 53 </a> 54 </span> 55 </div> 56 {{ end }} 57 </div>