From 5edba5cf2e63c78809564aa4b7d4bce52065fe8f Mon Sep 17 00:00:00 2001 From: Aphcity Date: Thu, 21 Mar 2024 10:17:55 +0800 Subject: [PATCH] Fix list.html render issue FIXED: execute of template failed: template: _default/list.html:23:19: executing "main" at <.File.Path>: error calling Path: runtime error: invalid memory address or nil pointer dereference --- layouts/_default/list.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 63b818b1..36bf195f 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -19,16 +19,17 @@
{{ partial "article-meta/list.html" (dict "context" . "scope" "single") }}
- - {{ $path := .File.Path }} - {{range .AllTranslations}} - {{ $lang := print "." .Lang ".md" }} - {{ $path = replace $path $lang ".md" }} - {{end}} + {{ with .File }} + {{ $path := .File.Path }} + {{range .AllTranslations}} + {{ $lang := print "." .Lang ".md" }} + {{ $path = replace $path $lang ".md" }} + {{end}} + {{ end }} {{ $jsPage := resources.Get "js/page.js" }} {{ $jsPage = $jsPage | resources.Minify | resources.Fingerprint "sha512" }} @@ -145,4 +146,4 @@ {{ partial "pagination.html" . }} - {{ end }} \ No newline at end of file + {{ end }}