From 7dce8665f0719c498a4fad26ab73b6abb9bffa59 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 19 Aug 2019 15:08:55 +0200
Subject: [PATCH] [web] Added breadcrumb navigation.

---
 web/assets/scss/main.scss             | 17 +++++++++++++++++
 web/content/docs/_index.pandoc        |  4 ++--
 web/content/docs/benchmarks/_index.md |  3 +++
 web/layouts/docs/single.html          |  8 --------
 web/layouts/partials/breadcrumb.html  | 20 ++++++++++++++++++++
 web/layouts/partials/header.html      |  7 +++++++
 6 files changed, 49 insertions(+), 10 deletions(-)
 create mode 100644 web/content/docs/benchmarks/_index.md
 create mode 100644 web/layouts/partials/breadcrumb.html

diff --git a/web/assets/scss/main.scss b/web/assets/scss/main.scss
index 857c4dbfaf8..df60e001343 100644
--- a/web/assets/scss/main.scss
+++ b/web/assets/scss/main.scss
@@ -135,6 +135,23 @@ cite::before {
   }
 }
 
+ol.breadcrumb {
+  @apply py-2;
+}
+
+ol.breadcrumb li {
+  display: inline;
+}
+
+ol.breadcrumb li+li:before {
+  @apply px-1;
+  content: "/\00a0";
+}
+
+ol.breadcrumb li.active a {
+  color: theme('mycolors.text-accent');
+}
+
 /* -- Table of contents -- */
 #TableOfContents {
   @apply .text-sm;
diff --git a/web/content/docs/_index.pandoc b/web/content/docs/_index.pandoc
index 55b2439dd22..ef8d32e4aa6 100644
--- a/web/content/docs/_index.pandoc
+++ b/web/content/docs/_index.pandoc
@@ -14,8 +14,8 @@ text = "You want to contribute to the OpenGeoSys project or implement a custom f
 icon = "fal fa-laptop-code"
 
 [[sections]]
-name = "Selected Benchmarks"
-url = "/docs/benchmarks"
+name = "Benchmarks"
+url = "/docs/benchmarks/elliptic/groundwater-flow-dirichlet/"
 text = "Basic benchmarks are explained and input files are provided to get you started in using OGS."
 icon = "fal fa-rabbit-fast"
 
diff --git a/web/content/docs/benchmarks/_index.md b/web/content/docs/benchmarks/_index.md
new file mode 100644
index 00000000000..d604396d40f
--- /dev/null
+++ b/web/content/docs/benchmarks/_index.md
@@ -0,0 +1,3 @@
++++
+title = "Benchmarks"
++++
diff --git a/web/layouts/docs/single.html b/web/layouts/docs/single.html
index dab7327884f..0b0a666f3f2 100644
--- a/web/layouts/docs/single.html
+++ b/web/layouts/docs/single.html
@@ -3,14 +3,6 @@
   <nav class="w-1/4">
     {{ $segments := split .RelPermalink "/" }}
     {{ $subsection := index $segments 2 }}
-    <div class="text-xs">
-      <a href="/docs/">Docs</a> / <span class="text-orange">
-      {{ if eq $subsection "devguide"}}Developer Guide{{ end }}
-      {{ if eq $subsection "benchmarks"}}Benchmarks{{ end }}
-      {{ if eq $subsection "userguide"}}User Guide{{ end }}
-      {{ if eq $subsection "tools"}}Tools{{ end }}
-      </span>
-    </div>
     <ul class="text-sm">
       {{ $currentPage := . }}
       {{ $currentMenu := index .Site.Menus $subsection }}
diff --git a/web/layouts/partials/breadcrumb.html b/web/layouts/partials/breadcrumb.html
new file mode 100644
index 00000000000..c1c885ec593
--- /dev/null
+++ b/web/layouts/partials/breadcrumb.html
@@ -0,0 +1,20 @@
+<ol class="breadcrumb">
+  {{ template "breadcrumbnav" (dict "p1" . "p2" .) }}
+</ol>
+
+{{ 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 )  }}
+{{ end }}
+<li{{ if eq .p1 .p2 }} class="active"{{ end }}>
+  <a href="{{ .p1.Permalink }}">
+    {{ if .p1.IsHome }}
+    <i class="fas fa-home"></i>
+    {{ else }}
+      {{ .p1.Title }}
+    {{ end }}
+  </a>
+</li>
+{{ end }}
diff --git a/web/layouts/partials/header.html b/web/layouts/partials/header.html
index ca5ccb83d6f..08c06dd4d88 100644
--- a/web/layouts/partials/header.html
+++ b/web/layouts/partials/header.html
@@ -60,5 +60,12 @@
       </div>
       {{ end }}
     </div>
+    <div class="container">
+      <div class="w-auto">
+          <div class="text-xs">
+              {{ partial "breadcrumb" . }}
+            </div>
+      </div>
+    </div>
   </header>
   <div class="py-2">
-- 
GitLab