From e40c320135237101127d823da62b66eeb8c5ab44 Mon Sep 17 00:00:00 2001 From: avalos Date: Mon, 4 Jan 2021 14:11:01 -0600 Subject: [PATCH] Added ISODate (ISO 8601) function and set as default in index.tmpl --- src/post.go | 4 ++++ templates/index.tmpl | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/post.go b/src/post.go index cff60b4..f97e930 100644 --- a/src/post.go +++ b/src/post.go @@ -81,6 +81,10 @@ func (p *post) ReadableDate() string { return p.PostTime.Format("2 January 2006") } +func (p *post) ISODate() string { + return p.PostTime.Format("2006-01-02") +} + func (p *post) ISOTime() string { return p.PostTime.Format(time.RFC3339) } diff --git a/templates/index.tmpl b/templates/index.tmpl index a4ccdda..7ee2ea0 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -2,6 +2,6 @@ # {{.Title}} {{range .Posts}} -=> {{.Filename}} {{.ReadableDate}}: {{.Title}}{{end}} +=> {{.Filename}} {{.ISODate}} - {{.Title}}{{end}} => {{.URL}}/atom.xml Feed