smol icon indicating copy to clipboard operation
smol copied to clipboard

Respect parmas.dateFmt key's value on /posts/ page

Open etanot opened this issue 4 years ago • 0 comments

Type: Feature request.

On /posts/ page, datetime format is "2006-01-02", despite parmas.dateFmt key value being set to different value. This happens because we have hard coded the date format for /posts/ page.

https://github.com/colorchestra/smol/blob/4129f82cd766921c9a5a46e55f46ec1081bde167/layouts/_default/list.html#L16

It would be nice, if we would respect params.dateFmt key value.


One solution could be replace:

{{ .Date.Format "2006-01-02" }}

with

{{ .Date.Format (default "2006-01-02" .Site.Params.dateFmt)}}

But there is a one problem with this solution, if .params.dateFmt key value also contains time, /posts/ page will also contain time along with date, which I think nobody wants it (i.e. time along with date on /posts/ page).

etanot avatar Sep 16 '21 06:09 etanot