hugo-geekblog/layouts/partials/title.html

16 lines
356 B
HTML
Raw Normal View History

2020-07-06 18:55:32 +00:00
{{ $title := "" }}
{{ if .Title }}
2020-07-22 08:51:13 +00:00
{{ $title = .Title }}
2020-07-06 18:55:32 +00:00
{{ else if and .IsSection .File }}
2020-07-22 08:51:13 +00:00
{{ $title = path.Base .File.Dir | humanize | title }}
2020-07-06 18:55:32 +00:00
{{ else if and .IsPage .File }}
2020-07-22 08:51:13 +00:00
{{ $title = .File.BaseFileName | humanize | title }}
{{ end }}
{{ if eq .Kind "term" }}
{{ $title = $title | humanize | title }}
2020-07-06 18:55:32 +00:00
{{ end }}
{{ return $title }}