rhazdon / hugo-theme-hello-friend-ng

Pretty basic theme for Hugo that covers all of the essentials. All you have to do is start typing!
https://github.com/rhazdon/hugo-theme-hello-friend-ng/
Other
1.47k stars 784 forks source link

Extending the background-image feature to multiple content types within the theme #461

Open TunnelThruTime opened 10 months ago

TunnelThruTime commented 10 months ago

Hello, I've been attempting to extend the background-image feature within the theme for about a week inside my hectic schedule, which hasn't really allowed me much time to delve into the matter, however it seems recommendable to reach out the the developers for help in the matter.

In my layouts, 'layout/about/single.html', i've included the file mentioned here. my method for extending the feature was to simply cut and paste the lines in the list template. However doing so triggers a context disparity, and the error

 'render: failed to render pages: render of \"page\" failed: execute of template failed: 
html/template:about/single.html:5:23: {{if}} branches end in different contexts:
 {stateTag delimNone urlPartNone jsCtxRegexp attrNone elementNone <nil>}, 
{stateAttr delimDoubleQuote urlPartNone jsCtxRegexp attrNone elementNone <nil>}'

appears. An AI states that the insurance of "expressions, variables, and tags" should be consistent throughout 'if' and 'else' branches.

single.txt

as you can see from the link I've just copied and pasted a '{{define "about"}}' statement into the single.html that I wrote into the appropriate hugo context. Any help extending the background image feature would be appreciated, and if no I will try to post the solution here for others wishing to extend or facing similar issues elsewhere.