I would like to hide the year part of the date if the post was created in the current year, otherwise, show the year. So I was trying to compare the post’s date year with the current date year.
{{ if eq .Date.Year now.Year }}
{{ .Date.Format "January 2" }}
{{ else }}
{{ .Date.Format "January 2, 2016" }}
{{ end }}
I expected to see “January 2” for the posts created this year and “January 2, 2016” for the posts created previous to this year.
But instead, I am seeing “January 2, 2016” formatting for all posts. Where 2016 is parsed from “ddmm6”. Like “September 8, 8096” and “August 29, 29086”.