Hi, I noticed there was interest/plans to add Starlark/Starlight to Hugo for generating pages from data. With that in mind, I think it would be great if there was a way to be able to write custom template helpers/functions using the same language that ends up being embedded. I know I could add my own functions in Go, but I would really rather not have to maintain my own fork of Hugo and have to recompile it every time I need to add or change something.
There are a number of situations while trying to build a website that I find myself trying something complex that results in ugly template files and partials that would be more appropriately abstracted away from the template file as a script in an actual programming language.
For example: right now, I’m trying to create a way to have branch bundles inherit a thumbnail picture from the first image it finds in the first nested bundle it finds (sorted alphabetically, in descending order). Sounds simple, but it becomes complex to solve because some branch bundles will have to get its thumbnail from a nested branch bundle which in turn gets its thumbnail from another nested bundle (which could also be another branch bundle in which this cycle continues). The other complicated part is that for some branch bundles I might want to specify which nested branch/leaf bundle to get the thumbnail from or even provide a specific path to an image. This would be far easier to accomplish as a function written in a scripting language like Python/Starlark than to force this logic into Hugo’s Go template language, like I’m currently trying to do (haven’t gotten it to work yet).
Anyways, I love Hugo and all the work the devs are putting in it. Keep up the good work!