which reads the file correctly and outputs highlighted code. However, how do I pass in the {{ .Params.slug }} from my content to that function, so as to dynamically alter that partial directory path? Something like (but not, I know):
I have no idea why you had that in the first placeā¦ I assumed that for some odd reason, you directory name began with ', so I left it there ā¦
One of your files doesnāt have that .Params.slug setā¦ so thatās returning nilā¦ what you are seeing is because nil is trying to get printed using the %s.
Assuming that you have a default partial called components/foo.html, you can do:
Thanks for the catch on the single quote, I didnāt notice it was my typo.
I was perhaps not using slug correctly, so Iāve changed to ānicknameā as set in my contentās front-matter. (though yes, I am going to have a unique partial for each slug, Iām using Hugo for a pattern library website and the partials are the patterns Iām referencing to pull in to the page)
Iām able to call
{{ .Params.nickname }}
Just fine earlier in the template, so Iām not sure why itās not getting that here and returning nil instead?