code shreds

As cool as HUGO is, its templating language, based on go, is not as easy as go itself. From time to time I run into problems that I can only solve in a cumbersome way.

Here are some solutions that I have collected over time.

date/time

created onAugust 17, 2025
dateFormat works only for secific date the following works and renders on August 17th, 2025, the string 2025-08-17: ...

page

created onAugust 17, 2025
...

section

created onAugust 17, 2025
getting a section {{- $rootSection := .Site.GetPage (print "/" .Section "/_index.md") -}} ...

string

created onAugust 17, 2025
concatenating strings Strings can be concatenated with print: {{ $fruits := (print $someOtherFruits " kiwi" " banana" ) }} ...