nunocoracao / blowfish

Personal Website & Blog Theme for Hugo
https://blowfish.page
MIT License
1.37k stars 384 forks source link

Bug with related pages #1731

Closed Thanatermesis closed 1 week ago

Thanatermesis commented 1 week ago

With the last update of Blowfish & Hugo (extended) versions, I had this error:

Start building sites …
hugo v0.134.0-77df7bbbff8ce6b56ed693270088de973a87d5ce+extended linux/amd64 BuildDate=2024-09-03T09:54:22Z VendorInfo=gohugoio

ERROR render of "page" failed: "/elive-git/hugo-blog/themes/blowfish/layouts/_default/single.html:124:11": execute of template failed: template: _default/single.html:124:11: executing "main" at <partial "related.html" .>: error calling partial: "/elive-git/hugo-blog/themes/blowfish/layouts/partials/related.html:2:20": execute of template failed: template: partials/related.html:2:20: executing "partials/related.html" at <.Site.RegularPages.Related>: error calling Related: runtime error: invalid memory address or nil pointer dereference
Total in 235 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/elive-git/hugo-blog/themes/blowfish/layouts/_default/single.html:124:11": execute of template failed: template: _default/single.html:124:11: executing "main" – RegularPages is nil; wrap it in if or with: {{ with partial "related.html" .>: error calling partial: "/elive-git/hugo-blog/themes/blowfish/layouts/partials/related.html:2:20": execute of template failed: template: partials/related.html:2:20: executing "partials/related.html" at <.Site.RegularPages }}{{ .Related }}{{ end }}
Thanatermesis commented 1 week ago

Seems like changing this (default) hugo.toml configuration fixes the problem:

diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml
index c617539..cff2c81 100644
--- a/config/_default/hugo.toml
+++ b/config/_default/hugo.toml
@@ -65,7 +65,7 @@ googleAnalytics = "G-9K109Z8ZWP"
     [[related.indices]]
       applyFilter = false
       name = 'fragmentrefs'
-      type = 'fragments'
+      # type = 'fragments'
       weight = 10

Not sure if is needed the "type" entry but commenting it builds the website again and the related posts shows up, maybe it should be removed from the default configurations provided too

nunocoracao commented 1 week ago

The last version of the theme is running in prod @ blowfish.page using the related feature... so no there isn't an issue with related article in the latest update - at least in the generic sense like this ticket suggests.

Closing this issue as it doesn't provide enough detail for anyone to reproduce. Please re-open a new one following the bug template.

Thanatermesis commented 1 week ago

In short, the last comment which mentions "type = fragments" seems like a default config from blowfish which with it like that it seemed to not work