One of the things causing me confusion is trying to work out the different data types in Hugo. It looks like there are strings, paths and arrays. And slices? And then which functions work with each.
Sorry for the howl of pain. I really appreciate Hugo and the docs and this forum - but I think I need to learn Go before I can work out how to template.
{{ $subfolder := printf "Page(%s)" path.Dir(THEPATH) }} should do the trick. If not, you really need to post some sample code of what you are doing there. Blackbox, you know?
printf makes strings out of anything.
And by the way, it’s not Hugo’s data types, it’s Go’s datatypes. And yes… sometimes I think there is something with autism going on with the golang people, but in the end it all makes sense and is extremely simple. Somehow. We (normal people) just don’t get it.
I’m trying to do something which I’ve seen raised on here several times but never quite seen achieved: allowing the user to select different versions of the same topic.
I’ve tried {{ $pages := (where .Site.Pages "Section" .Section) }} - that just gives me all the pages in /examples/
while {{ $pages := (where .Site.Pages "CurrentSection" .CurrentSection) }} gives me nothing.
So I think I need to do some path manipulation. Something like "give me all pages which have the path of ( .CurrentSection with the end knocked off ) "