uci-doc/layouts/partials/page-header.html

43 lines
1.8 KiB
HTML
Raw Normal View History

2020-01-12 06:33:02 -08:00
{{ $geekdocRepo := default (default false .Site.Params.GeekdocRepo) .Page.Params.GeekdocRepo }}
{{ $geekdocEditPath := default (default false .Site.Params.GeekdocEditPath) .Page.Params.GeekdocEditPath }}
{{ if .File }}
2020-11-11 02:48:25 -08:00
{{ $.Scratch.Set "geekdocFilePath" (default .File.Path .Page.Params.GeekdocFilePath) }}
2020-01-12 06:33:02 -08:00
{{ else }}
{{ $.Scratch.Set "geekdocFilePath" false }}
{{ end }}
2020-02-05 00:40:05 -08:00
{{ define "breadcrumb" }}
2020-02-16 14:17:45 -08:00
{{ $parent := .page.Parent }}
2020-01-12 06:33:02 -08:00
{{ if $parent }}
2020-02-16 14:17:45 -08:00
{{ $name := (partial "title" $parent) }}
{{ $value := (printf "<a href='%s'>%s</a> / %s" $parent.RelPermalink $name .value) }}
2020-01-12 06:33:02 -08:00
{{ template "breadcrumb" dict "page" $parent "value" $value }}
2020-02-05 00:40:05 -08:00
{{ else }}
{{ .value | safeHTML }}
{{ end }}
{{ end }}
2020-01-12 06:33:02 -08:00
2020-02-26 15:08:00 -08:00
{{ $showBreadcrumb := (and (default true .Page.Params.GeekdocBreadcrumb) (default true .Site.Params.GeekdocBreadcrumb)) }}
2020-02-05 01:13:04 -08:00
{{ $showEdit := (and ($.Scratch.Get "geekdocFilePath") $geekdocRepo $geekdocEditPath) }}
<div class="gdoc-page__header flex flex-wrap justify-between{{ if not $showEdit }} hidden-mobile{{ end }}{{ if (and (not $showBreadcrumb) (not $showEdit)) }} hidden {{ end }}" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
2020-01-12 06:33:02 -08:00
<span>
2020-02-05 00:40:05 -08:00
{{if $showBreadcrumb }}
2020-11-09 13:06:06 -08:00
<span class="breadcrumb">
<svg class="icon path"><use xlink:href="#path"></use></svg>
{{ $name := (partial "title" .) }}
{{ template "breadcrumb" dict "page" . "value" $name }}
</span>
2020-01-12 06:33:02 -08:00
{{ end }}
</span>
<span>
2020-02-05 01:13:04 -08:00
{{ if $showEdit }}
2020-11-09 13:06:06 -08:00
<span class="editpage">
2020-01-12 06:33:02 -08:00
<svg class="icon code"><use xlink:href="#code"></use></svg>
<a href="{{ $geekdocRepo }}/{{ $geekdocEditPath }}/{{ $.Scratch.Get "geekdocFilePath" }}">
Edit this page
</a>
2020-11-09 13:06:06 -08:00
</span>
2020-01-12 06:33:02 -08:00
{{ end }}
</span>
</div>