Closed WaterLemons2k closed 7 months ago
Hi, thanks for the PR!
This issue is partially fixed in the canary branch: https://github.com/CaiJimmy/hugo-theme-stack/blob/canary/layouts/partials/widget/taxonomy.html, where the tag-cloud
and categories
widgets are merged into one taxonomy
widget, which requires params.type
. (The error you mention only occurs if params
is empty.)
However, it's not fixed for the archives
widget. So I think we can merge the changes you made to the archives
widget into the canary
branch. Does that sound good to you?
Thanks for your reply!
It seems that the nil pointer evaluating interface {}
error only occurs when params
is nil, so ensuring that params
is not nil sounds better.
This is good for all widgets that use params
, as there is no need to worry about params
being nil.
If the
params
key is not defined in the config file, you will get an error when getting any value for.Params
:This is because when the
params
key is undefined,.Params
is nil (note this is completely different from an empty map), and nil cannot be used as a map.To fix this, just make sure
params
is always map and not nil.