feat: address Hugo v0.92 notice RE changing behaviour of .Path (#2642)

This commit is contained in:
Mickaël Canouil authored and GitHub committed 2022-03-03 20:24:39 +00:00
1 parent 7d4f8d5650
commit 97a4b87534
6 files changed
+6 -6

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@
{{/* Show the About widget if an account exists for this user. */}}
{{ if .File }}
{{ $widget := "widgets/about.html" }}
{{ $username := (path.Base (path.Split .Path).Dir) }}{{/* Alternatively, use `index .Params.authors 0` */}}
{{ $username := (path.Base .File.Dir) }}{{/* Alternatively, use `index .Params.authors 0` */}}
{{ $params := dict "root" $ "page" . "author" $username }}
{{ partial $widget $params }}
{{end}}
+1 -1
View File
@@ -27,7 +27,7 @@
{{/* Correct the title and URL for author profile pages. */}}
{{- if eq .Section "authors" -}}
{{- $username := path.Base (path.Split .Path).Dir -}}
{{- $username := path.Base .File.Dir -}}
{{- with site.GetPage (printf "/authors/%s" $username) -}}
{{- $permalink = .Permalink -}}
{{- $rel_permalink = .RelPermalink -}}
+1 -1
View File
@@ -53,7 +53,7 @@
{{ $superuser_role := "" }}
{{ range first 1 (where (where site.Pages "Section" "authors") "Params.superuser" true) }}
{{ $superuser_name = .Title }}
{{ $superuser_username = path.Base (path.Split .Path).Dir }}
{{ $superuser_username = path.Base .File.Dir }}
{{ $superuser_role = .Params.role }}
{{ end }}
{{ $scr.Set "superuser_username" $superuser_username }}{{/* Set superuser globally for page_author.html. */}}
+1 -1
View File
@@ -89,7 +89,7 @@
{{ end }}
{{/* Fix Hugo's ContentBaseName returning wrong file base name when page section is within a bundle. */}}
{{ $hash_id := replace $st.File.ContentBaseName "index" (path.Base (path.Split .Path).Dir) }}
{{ $hash_id := replace $st.File.ContentBaseName "index" (path.Base .File.Dir) }}
{{ $widget := or $st.Params.widget "blank" }}
{{ if eq $widget "custom" }}{{ $widget = "blank" }}{{ end }}{{/* Support legacy Custom widget */}}
@@ -35,7 +35,7 @@
{{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
{{/* Get link to user's profile page. */}}
{{ $link := "" }}
{{ with site.GetPage (printf "/authors/%s" (path.Base (path.Split .Path).Dir)) }}
{{ with site.GetPage (printf "/authors/%s" (path.Base .File.Dir)) }}
{{ $link = .RelPermalink }}
{{ end }}
<div class="col-12 col-sm-auto people-person">
+1 -1
View File
@@ -7,7 +7,7 @@
{{/* Validate Pub Type if defined */}}
{{ if gt $pub_type (sub (len $pub_types) 1) }}
{{ warnf "Unknown publication type in %s" .Path }}
{{ warnf "Unknown publication type in %s" .File.Path }}
{{ $pub_type = 0 }}
{{ end }}