SnailShell

TIL: HTML Has a <time> Tag


Today I learned that HTML has a <time> tag which supplements a written date and time with a machine-readable format.1 Supposedly, this helps with parsability, and in turn, good for accessibility. I’ve added this into my Hugo template for metadata.

{{- $isoFormat := "2006-01-02T15:04:05" -}}
{{- $humanFormat := "02 Jan 2006" -}}
...
<time datetime="{{ .Params.date.Format $isoFormat }}">{{ .Params.date.Format $humanFormat }}</time>
...