diff options
author | Alex Shpak <alex-shpak@users.noreply.github.com> | 2019-04-22 22:19:08 +0200 |
---|---|---|
committer | Alex Shpak <alex-shpak@users.noreply.github.com> | 2019-04-22 22:19:08 +0200 |
commit | b10d1e959c25a36cf58f570d12d15820ca1d3ee7 (patch) | |
tree | 40722bf76ee6602a5d629e955ae6fc38e652cf5d /layouts/partials/docs/shared.html | |
parent | 0b30289d9f3520144bb37caa009d8953cde0e3d6 (diff) |
Improve logic in title template for less warnings
Diffstat (limited to 'layouts/partials/docs/shared.html')
-rw-r--r-- | layouts/partials/docs/shared.html | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/layouts/partials/docs/shared.html b/layouts/partials/docs/shared.html index 2678840..a5075c8 100644 --- a/layouts/partials/docs/shared.html +++ b/layouts/partials/docs/shared.html @@ -1,12 +1,14 @@ {{/*These templates contains some more complex logic and shared between partials*/}} {{ define "title" }} - {{ if and .File .Pages }} + {{ if and .IsSection .File }} {{ $sections := split (trim .File.Dir "/") "/" }} {{ $title := index ($sections | last 1) 0 | humanize | title }} {{ default $title .Title }} - {{ else if .File }} - {{ $title := .File.BaseFileName | humanize | title }} + {{ else if and .IsPage .File }} + {{ $title := .File.BaseFileName | humanize | title }} {{ default $title .Title }} + {{ else }} + {{ .Title }} {{ end }} {{ end }} |