I want to specify in the frontmatter than an event will happen in the future, and then display that date in a human readable format when the page is rendered.
Because the date of the show is not the same as the date that the post was created/updated, I use “show_date” in the frontmatter, and collect that as a ISO 8601 timestamp. Right now, this is what I have:
frontmatter
date: 2016-06-20T10:00:00-06:00
show_date: 2016-06-23T13:00:00-06:00
number: 152
calendar: [LINK TO GOOGLE CALENDAR EVENT]
single.html
<h6>Episode {{ with .Params.number }}{{ . }}{{ end }} airs live on {{ with .Params.calendar }}<a href="{{ . }}">{{ end }}{{ .Date.Format "Mon Jan 2, 2006 at 3:04 PM U.S. Central Time" }}</a></h6>
This works, but it shows the date of the post, not the date of the show.
I’ve tried {{ .Params.show_date.Format "Mon Jan 2, 2006 at 3:04 PM U.S. Central Time" }}
which does not work.
I know that I can just use a string for the Show Date, but I’d rather use a standard format for the date, and format that in whichever way fits the context best.
How can I specify that show_date
is a Date variable, which can be formatted?