all repos — homestead @ 5f57f420477f91d5ab3bc3a1e0ce8eb42d54c9f4

Code for my website

add date to non-post pages

Alan Pearce
commit

5f57f420477f91d5ab3bc3a1e0ce8eb42d54c9f4

parent

85869a216b69c2ce0384530ea4c3b18381abf7c3

1 file changed, 24 insertions(+), 1 deletion(-)

jump to
M templates/page.templtemplates/page.templ
@@ -14,7 +14,30 @@ "rel": "author",
}, Path: page.URL, }) { - <h1 class="p-name">{ page.Title }</h1> + <article> + <header> + <h1 class="p-name">{ page.Title }</h1> + <p class="meta"> + if !page.Date.IsZero() { + <span class="date"> + Published: + <a class="u-url" href={ templ.SafeURL(page.URL) }> + @postDate(page.Date, "dt-published") + </a> + </span> + } + // one commit: not updated + if (page.Date.IsZero() && len(page.Commits) > 0) || len(page.Commits) > 1 { + <span class="date last-updated"> + Last updated: + <a href={ templ.URL(page.Commits[0].Link.String()) }> + @postDate(page.Commits[0].Date, "dt-updated") + </a> + </span> + } + </p> + </header> + </article> <div class="content"> @page </div>