Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/it-gro/hugo-theme-w3css-basic.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-gro <grossnik@tuvok>2018-07-09 11:57:29 +0300
committerit-gro <grossnik@tuvok>2018-07-09 11:57:29 +0300
commitcee1aa98bf866658bab360bd3024eeed7136206e (patch)
tree0c04112d0a4dbd567382da62a6afb033801cf0b7 /layouts
parent7df3f667f79fc49fdb2c89e05e5c78c7da131eb7 (diff)
Add breadcrump
Diffstat (limited to 'layouts')
-rw-r--r--layouts/pages/list.html5
-rw-r--r--layouts/partials/page.nav.breadcrump.html34
2 files changed, 39 insertions, 0 deletions
diff --git a/layouts/pages/list.html b/layouts/pages/list.html
index b57bbbf..ab5504c 100644
--- a/layouts/pages/list.html
+++ b/layouts/pages/list.html
@@ -4,6 +4,11 @@
{{- end}}
{{- if $.Site.Params.debug }}pages/list.html{{ end }}
+ {{ partial `page.nav.breadcrump.html` . }}
+ {{- if or $.Site.Params.debug (findRE `\bhtml-comment\b` $.Site.Params.traceFlags) }}
+ {{ `<!-- back in pages/list.html (main) -->` | safeHTML }}
+ {{- end}}
+
{{ partial `page.nav.cards.html` . }}
{{- if or $.Site.Params.debug (findRE `\bhtml-comment\b` $.Site.Params.traceFlags) }}
{{ `<!-- back in pages/list.html (main) -->` | safeHTML }}
diff --git a/layouts/partials/page.nav.breadcrump.html b/layouts/partials/page.nav.breadcrump.html
new file mode 100644
index 0000000..9d8ce8e
--- /dev/null
+++ b/layouts/partials/page.nav.breadcrump.html
@@ -0,0 +1,34 @@
+{{- if isset $.Site.Params (lower `options` ) -}}
+ {{- if $.Site.Params.options.showNavBreadcrump -}}
+
+ {{- if or $.Site.Params.debug (findRE `\bhtml-comment\b` $.Site.Params.traceFlags) }}
+ {{ `<!-- partials/page.nav.breadcrump.html -->` | safeHTML }}
+ {{- end }}
+
+ <div class="w3-bar w3-mobile breadcrump-button w3-small {{ default `w3-theme-d3` ($.Site.Param `colorPageNavBreadcrumpBar`) }} ">
+ {{ template "breadcrumbnav" (dict "mySite" $.Site "p1" . "p2" .) }}
+ </div>
+
+ {{- end }} {{/* showNavBreadcrump */}}
+{{- end }} {{/* options */}}
+
+{{- define "breadcrumbnav" }}
+{{- if .p1.Parent }}
+ {{- template "breadcrumbnav" (dict "mySite" .mySite "p1" .p1.Parent "p2" .p2 ) }}
+{{- else if not .p1.IsHome }}
+ {{- template "breadcrumbnav" (dict "mySite" .mySite "p1" .p1.Site.Home "p2" .p2 ) }}
+{{- end }}
+<div class="w3-bar-item w3-button breadcrump-button w3-mobile w3-small">
+ {{- if not .p1.IsHome }}
+ {{- if .mySite.Params.options.navbreadcrumptitle -}}
+ <a href="{{ .p1.Permalink }}">{{.p1.Title | safeHTML }}/</a>
+ {{- else }}
+ <a href="{{ .p1.Permalink }}">{{replaceRE ".*/" "" ( (urls.Parse .p1.Permalink).Path | relURL | strings.TrimSuffix "/") | humanize }}/</a>
+ {{- end }}
+ {{- else }}
+ {{- if .mySite.Params.options.navbreadcrumphome -}}
+ <a href="{{ .p1.Permalink }}">{{.p1.Kind | humanize }}</a>
+ {{- end }}
+ {{- end }}
+</div>
+{{ end }}