2023-06-22 07:45:54 +00:00
|
|
|
{{ $geekdocRepo := default (default false .Site.Params.geekdocRepo) .Page.Params.geekdocRepo }}
|
|
|
|
{{ $geekdocEditPath := default (default false .Site.Params.geekdocEditPath) .Page.Params.geekdocEditPath }}
|
2020-01-12 14:33:02 +00:00
|
|
|
{{ if .File }}
|
2023-06-22 07:45:54 +00:00
|
|
|
{{ $.Scratch.Set "geekdocFilePath" (default (path.Join (default "content" .Site.Params.contentDir) .File.Path) .Page.Params.geekdocFilePath) }}
|
2020-01-12 14:33:02 +00:00
|
|
|
{{ else }}
|
2022-01-06 12:58:10 +00:00
|
|
|
{{ $.Scratch.Set "geekdocFilePath" false }}
|
2020-01-12 14:33:02 +00:00
|
|
|
{{ end }}
|
|
|
|
|
2020-02-05 08:40:05 +00:00
|
|
|
{{ define "breadcrumb" }}
|
2022-01-06 12:58:10 +00:00
|
|
|
{{ $parent := .page.Parent }}
|
|
|
|
{{ if $parent }}
|
2022-02-07 09:57:43 +00:00
|
|
|
{{ $name := (partial "utils/title" $parent) }}
|
2022-01-06 12:58:10 +00:00
|
|
|
{{ $position := (sub .position 1) }}
|
|
|
|
{{ $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) }}
|
|
|
|
{{ template "breadcrumb" dict "page" $parent "value" $value "position" $position }}
|
|
|
|
{{ else }}
|
|
|
|
{{ .value | safeHTML }}
|
|
|
|
{{ end }}
|
2020-02-05 08:40:05 +00:00
|
|
|
{{ end }}
|
2020-01-12 14:33:02 +00:00
|
|
|
|
2023-06-22 07:45:54 +00:00
|
|
|
{{ $showBreadcrumb := (and (default true .Page.Params.geekdocBreadcrumb) (default true .Site.Params.geekdocBreadcrumb)) }}
|
2020-02-05 09:13:04 +00:00
|
|
|
{{ $showEdit := (and ($.Scratch.Get "geekdocFilePath") $geekdocRepo $geekdocEditPath) }}
|
2022-01-06 12:58:10 +00:00
|
|
|
<div
|
|
|
|
class="gdoc-page__header flex flex-wrap
|
|
|
|
{{ if $showBreadcrumb }}
|
|
|
|
justify-between
|
|
|
|
{{ else }}
|
|
|
|
justify-end
|
|
|
|
{{ end }}
|
|
|
|
{{ if not $showEdit }}hidden-mobile{{ end }}
|
|
|
|
{{ if (and (not $showBreadcrumb) (not $showEdit)) }}hidden{{ end }}"
|
|
|
|
itemprop="breadcrumb"
|
|
|
|
>
|
|
|
|
{{ if $showBreadcrumb }}
|
2021-02-20 21:54:49 +00:00
|
|
|
<div>
|
2022-04-18 18:33:23 +00:00
|
|
|
<svg class="gdoc-icon gdoc_path hidden-mobile"><use xlink:href="#gdoc_path"></use></svg>
|
2022-01-06 12:58:10 +00:00
|
|
|
<ol class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
|
|
|
|
{{ $position := sub (len (split .RelPermalink "/")) 1 }}
|
2022-02-07 09:57:43 +00:00
|
|
|
{{ $name := (partial "utils/title" .) }}
|
2022-01-06 12:58:10 +00:00
|
|
|
{{ $value := (printf "<li itemprop='itemListElement' itemscope itemtype='https://schema.org/ListItem'><span itemprop='name'>%s</span><meta itemprop='position' content='%d' /></li>" $name $position ) }}
|
|
|
|
{{ template "breadcrumb" dict "page" . "value" $value "position" $position }}
|
|
|
|
</ol>
|
2021-02-20 21:54:49 +00:00
|
|
|
</div>
|
2022-01-06 12:58:10 +00:00
|
|
|
{{ end }}
|
|
|
|
{{ if $showEdit }}
|
2021-02-20 21:54:49 +00:00
|
|
|
<div>
|
2022-01-06 12:58:10 +00:00
|
|
|
<span class="editpage">
|
2022-04-18 18:33:23 +00:00
|
|
|
<svg class="gdoc-icon gdoc_code"><use xlink:href="#gdoc_code"></use></svg>
|
2022-01-06 12:58:10 +00:00
|
|
|
<a
|
|
|
|
href="{{ $geekdocRepo }}/{{ path.Join $geekdocEditPath ($.Scratch.Get "geekdocFilePath") }}"
|
|
|
|
>
|
2022-01-23 12:21:44 +00:00
|
|
|
{{ i18n "edit_page" }}
|
2022-01-06 12:58:10 +00:00
|
|
|
</a>
|
|
|
|
</span>
|
2021-02-20 21:54:49 +00:00
|
|
|
</div>
|
2022-01-06 12:58:10 +00:00
|
|
|
{{ end }}
|
2020-01-12 14:33:02 +00:00
|
|
|
</div>
|