Adjust .File usage to get rid of WARNINGs
Note that this requires this fix in Hugo 0.55.2: https://github.com/gohugoio/hugo/issues/5865
This commit is contained in:
committed by
Alex Shpak
parent
4054b1b520
commit
5affd26bfb
@@ -1,10 +1,10 @@
|
||||
{{/*These templates contains some more complex logic and shared between partials*/}}
|
||||
{{- define "title" -}}
|
||||
{{- if .Pages -}}
|
||||
{{ $sections := split (trim .Dir "/") "/" }}
|
||||
{{- if and .File .Pages -}}
|
||||
{{ $sections := split (trim .File.Dir "/") "/" }}
|
||||
{{ $title := index ($sections | last 1) 0 | humanize | title }}
|
||||
{{- default $title .Title -}}
|
||||
{{- else -}}
|
||||
{{- else if .File -}}
|
||||
{{ $title := .File | humanize | title }}
|
||||
{{- default $title .Title -}}
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user