From b10d1e959c25a36cf58f570d12d15820ca1d3ee7 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Mon, 22 Apr 2019 22:19:08 +0200 Subject: Improve logic in title template for less warnings --- layouts/partials/docs/shared.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'layouts/partials/docs/shared.html') 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 }} -- cgit v1.2.3