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 | |
parent | 0b30289d9f3520144bb37caa009d8953cde0e3d6 (diff) |
Improve logic in title template for less warnings
Diffstat (limited to 'layouts/partials')
-rw-r--r-- | layouts/partials/docs/html-head.html | 2 | ||||
-rw-r--r-- | layouts/partials/docs/shared.html | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/layouts/partials/docs/html-head.html b/layouts/partials/docs/html-head.html index 7f7c0cc..ab05a59 100644 --- a/layouts/partials/docs/html-head.html +++ b/layouts/partials/docs/html-head.html @@ -15,7 +15,7 @@ <!-- RSS --> {{ with .OutputFormats.Get "rss" -}} - {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} {{ "<!--" | safeHTML }} 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 }} |