mirror of
https://github.com/imfing/hextra.git
synced 2025-06-20 14:41:21 -04:00
chore: adapt theme to new template system (#696)
* Adapted theme's layout to [Hugo v0.146.0](https://gohugo.io/templates/new-templatesystem-overview/) * Bumped minimal Hugo version to v0.146.0
This commit is contained in:
19
layouts/_partials/utils/title.html
Normal file
19
layouts/_partials/utils/title.html
Normal file
@ -0,0 +1,19 @@
|
||||
{{/*
|
||||
This utility is used to retrieve the title of a page or section.
|
||||
If no title is set, it falls back to using the directory or file name.
|
||||
|
||||
Based on https://github.com/thegeeklab/hugo-geekdoc/blob/v0.44.0/layouts/partials/utils/title.html
|
||||
*/}}
|
||||
{{- $title := "" }}
|
||||
|
||||
{{ if .LinkTitle }}
|
||||
{{ $title = .LinkTitle }}
|
||||
{{ else if .Title }}
|
||||
{{ $title = .Title }}
|
||||
{{ else if and .IsSection .File }}
|
||||
{{ $title = path.Base .File.Dir | humanize | title }}
|
||||
{{ else if and .IsPage .File }}
|
||||
{{ $title = .File.BaseFileName | humanize | title }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $title -}}
|
Reference in New Issue
Block a user