So what I thought was hard coding, didn’t actually work, though I don’t see why it would not work? The code above is inside the nav.html partial, but the images only show on the index.html page. On single or list pages, the images are broken.
I perused through a bunch of Hugo templates, trying to find examples how to do these social icons the “proper” way. Every template I checked out uses a bunch of JavaScript, custom CSS, and linking to icon packs like Font Awesome. This is both complete overkill for my simple website and way over my head.
I actually found a post by you, jmooring, tonight while trying to figure this out. I copied your code in the solution, but keep getting EOF errors. Is this code incomplete? I tried placing ``{{ end }}` statement where I thought appropriate, but I can’t get it to work.
Your solution is similar to what I was trying before I made this post. I made new social/icon entries in my hugo.toml, adding the name, URL, and image path. I then tried using range
, resources.Get
, and resources.GetMatch
, the latter two of which I found in the documentation examples. No luck.
Thanks