After working through a few errors I was able to get the site to serve and build.
However, my entire breadcrumb (top of page) and background image are not formatted now (or background image loading). But I am able to build the site and upload via FTP so I can view source on the generated files.
REALLY appreciate the kind assistance!
It’s been a long (10 hr) day here, so I will get back at it tomorrow.
Thanks again. You correctly anticipated the lack of the breadcrumbs div not being written in the ELSE. Also, I had NOT figured out that the with should be an if - so appreciate that catch also.
So with those changes everything looked right, except I was still not getting the background image inline style written (The ELSE was being written instead). So I went back and did a printf $variableName after each variable assignment. All was good up until I asked it to:
That returned this error message:
render of "page" failed: "D:\Hugo\HugoSites\01\themes\half-fast\layouts\machine\single.html:14:10": execute of template failed at <$assetImage>: wrong type for value; expected string; got resource.Resource render of "page" failed: wrong type for value; expected string; got resource.Resource failed to render pages: wrong type for value; expected string; got resource.Resource
That’s a new one for me so Googling that now, but happy to hear from anyone who knows the fix for this. If it makes a difference, the pages using this are ALL kind: "machine" (defined in Front Matter). THX!
Thanks for hanging in there with me on this!
I’m afraid I don’t know what you are referring to as the “console”. However, I removed the warnf and just made it printf on the visible page (since it is rendering with the else code).
So here is what my code looks like now. (Noob attempting to recast the string to a resource for the first time):
But, as an aside, I want to clarify resources.FromString.
That creates a ‘resource object’ (that does the same thing as .Resources.GetMatch) only it creates it from a the string you provide instead of from a file. So it’s actually not what you want. It also writes the resources to the build cache at the path your specify.
So what the docs say is:
resources.FromString which takes two arguments, the given string and the resource target path.
which mean that this:
resources.FromString $combinedFilename $directory
tells Hugo create a resource from the literal string (not the file at the location, but the actual characters in the filename) with the filename $directory (in /public of course, but only in cache unless you .Permalink it or similar). You were then assigning the resource (not a string with a path) to $fullPathAndFilenameRecast.
I don’t think that is quite what you were looking for.
So THAT SHOULD work. But something is not working in the GetMatch. (I’ve also tried .Resources.Get and using.Page.Resources.GetMatch and .Page.Resources.Get). No joy on any of them (but page still renders and give me the proper bgimage in the debugging printf.
An image with that exact name DOES exist in /themes/themeName/assets/img
What happens if you view the Terminal while the server is running? (Does the Terminal get hidden due to lack of screen space? Or are you just looking at a browser instead of VSCode, or is there something I haven’t thought of that you are doing?
AH. I see what you are saying.
I normally leave the terminal open in VSCode (below the code window). If I see a number pop up on the Problems tab I will switch from the terminal to that sometimes. But scrolling up through the Terminal window I DO see that ERRORs are written there. I’m assuming the warnf was also, but the buffer doesn’t allow me to scroll back that far. I’ll watch for it in the future. Thanks again!