Improve page title handling and side menu templates

This commit is contained in:
Alex Shpak
2018-09-17 18:29:36 +02:00
parent 0dec1cd3a8
commit 561659ed53
6 changed files with 50 additions and 40 deletions
+11
View File
@@ -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 }}