From baaf4ee9756d29f6ca9dab8386abc8f54a8fb05f Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 6 Apr 2021 12:32:43 -0700 Subject: layout: add date and tags to single pages We want to show the tags and the published/updated date for the articles. Add to the CSS the classes for these new elements. --- layouts/_default/single.html | 27 ++++++++++++++++++++++++++- static/css/custom.css | 16 ++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index a8c1dc7..0ab5e35 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,7 +4,32 @@

{{ .Title }}

-

{{ .Date.Format "January 2021" }}

+
+ {{- $pub := .Date.Format "2006-01-02" -}} + {{- $mod := "" -}} + {{- if (not .GitInfo) }} + {{- $mod = .Lastmod.Format "2006-01-02" -}} + {{ else }} + {{- $mod = .Page.GitInfo.CommitDate.Format "2006-01-02" -}} + {{ end -}} + {{ if eq $pub $mod }} +
published {{ $pub }}
+ {{ else }} +
published {{ $pub }}, last modified {{ $mod }}
+ {{ end }} + {{ if .Params.tags }} +
+ {{ if eq (len .Params.tags) 1 }} + in tag + {{ else }} + in tags + {{ end }} + {{ range $idx, $tag := .Params.tags }} + {{ $tag }} + {{ end }} +
+ {{ end }} +
{{ .Content }} diff --git a/static/css/custom.css b/static/css/custom.css index b0ec570..9d4faf1 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -53,3 +53,19 @@ pre { font-family: "Roboto Mono", Monaco, "Lucida Console", monospace; overflow: scroll; } + +.tags { + background-color: #eeeeee; + border-radius:8px; + padding:0 .5rem; + font-size: 90%; +} + +.meta_tags a:link, +.meta_tags a:visited { + text-decoration: none; +} + +.meta_date { + font-style: italic; +} -- cgit 1.4.1