I have a content folder named “images” and I add date to each of the image, these images are historical so I might not know the date at a day precision.
So I would like to just put date “1980” if I know that this picture was taken sometime in the year 1980. Right now I get a parse error when I try to use .Date.Format.
My need is to have something like that:
if it’s only the year, then show just the year
if it’s the year plus the month then format to show the Year + Month
if it’s the year + month + day then format as usual.
So I created complex logic in my template to do custom parsing.
It would be ideal if I could define my own go function to handle because it’s a lot of code in the template.
I’m just sharing this as an example of a use case of hugo to do complex logic template.