Przeglądaj źródła

fix: build fails on Windows: "Error: Could not find author page at..."

Caused due to Windows backslashes in path when extracting username from
folder name.

Fix #1068
George Cushen 6 lat temu
rodzic
commit
71f0959b9e
1 zmienionych plików z 2 dodań i 2 usunięć
  1. 2 2
      layouts/authors/list.html

+ 2 - 2
layouts/authors/list.html

@@ -15,8 +15,8 @@
     {{/* Show the About widget if an account exists for this user. */}}
     {{ if .File }}
       {{ $widget := "widgets/about.html" }}
-      {{ $slug := delimit (last 1 (split (trim .File.Dir "/") "/")) "" }}{{/* Alternatively, use `index .Params.authors 0` */}}
-      {{ $params := dict "root" $ "page" . "author" $slug }}
+      {{ $username := (path.Base (path.Split .Path).Dir) }}{{/* Alternatively, use `index .Params.authors 0` */}}
+      {{ $params := dict "root" $ "page" . "author" $username }}
       {{ partial $widget $params }}
     {{end}}