From daa0d0744b9f9b5da8367f99dc2146bad328e056 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 15 Apr 2020 09:20:00 +0200 Subject: [PATCH] make title generation cross-platform --- layouts/partials/title.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/layouts/partials/title.html b/layouts/partials/title.html index f4147ff..a792c04 100644 --- a/layouts/partials/title.html +++ b/layouts/partials/title.html @@ -1,12 +1,11 @@ {{ $title := "" }} {{ if .Title }} - {{ $title = .Title }} + {{ $title = .Title }} {{ else if and .IsSection .File }} - {{ $sections := split (trim .File.Dir "/") "/" }} - {{ $title = index ($sections | last 1) 0 | humanize }} + {{ $title = path.Base .File.Dir | humanize | title }} {{ else if and .IsPage .File }} - {{ $title = .File.BaseFileName | humanize | title }} + {{ $title = .File.BaseFileName | humanize | title }} {{ end }} {{ return $title }}