gokarna-theme / gokarna-hugo

A minimal opinionated theme for Hugo
https://gokarna-hugo.netlify.app
GNU General Public License v3.0
358 stars 140 forks source link

Change date format #135

Closed MacKarp closed 11 months ago

MacKarp commented 1 year ago

Hello! Can you please change hard coded date format to accept [params] format? I'm creating my website with this awesome theme, but in Poland we don't use January, 2 2006 we use 2 January 2006 and in general it will be better to end user choose their preferred format. I can make PR with this changes but I'm new to Hugo and don't know how exactly those changes will do to theme in general... To have same date format like is now you would need to: In config.toml you would need to add:

[params]
  dateFormat = "January, 2 2006"

in layouts/partials/list-posts.html change:

<span class="post-date">{{ dateFormat "January 2, 2006" .Date }}</span>

to:

<span class="post-date"> {{ dateFormat .Site.Params.dateFormat .Date }} </span>

and in: layouts/partials/post.html change:

{{ dateFormat "January 2, 2006" .Date }}

to:

 {{ dateFormat .Site.Params.dateFormat .Date }}