aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/docs/shared.html
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2018-09-17 18:29:36 +0200
committerAlex Shpak <alex-shpak@users.noreply.github.com>2018-09-17 18:29:36 +0200
commit561659ed53a1eb1e7583513af5fa2faba55fca7e (patch)
treea43ff90df5e613d0be23010df7abdd0666c7020f /layouts/partials/docs/shared.html
parent0dec1cd3a8845fa81a0c88d10e6b5597701d6c1e (diff)
Improve page title handling and side menu templates
Diffstat (limited to 'layouts/partials/docs/shared.html')
-rw-r--r--layouts/partials/docs/shared.html11
1 files changed, 11 insertions, 0 deletions
diff --git a/layouts/partials/docs/shared.html b/layouts/partials/docs/shared.html
new file mode 100644
index 0000000..f7ba182
--- /dev/null
+++ b/layouts/partials/docs/shared.html
@@ -0,0 +1,11 @@
+<!-- These templates contains some more complex logic and shared between partials-->
+{{ define "title" }}
+ {{- if .Pages -}}
+ {{ $sections := split (trim .Dir "/") "/" }}
+ {{ $title := index ($sections | last 1) 0 | humanize | title }}
+ {{- default .Title $title -}}
+ {{- else -}}
+ {{ $title := .File | humanize | title }}
+ {{- default .Title $title -}}
+ {{- end -}}
+{{ end }}