alex-shpak / hugo-book

Hugo documentation theme as simple as plain book
https://hugo-book-demo.netlify.app
MIT License
3.4k stars 1.17k forks source link

use time.Format in date partial to allow localized formatting #582

Closed hedzards closed 4 months ago

hedzards commented 9 months ago

Hi,

I am completely new to Hugo and just barely got to know your theme that fits nicely for my needs. I tried to set

BookDateFormat: ":date_long"

to get localized values for the date in posts. Unfortunately that does not work. I changed partials/date.html to

{{- return (time.Format $format .Date) -}}

which does what I expect. Is this the right way to do it? And would that be an adjustment that makes sense in general?

Regards Hendrik

alex-shpak commented 7 months ago

Hi! Yes, that partial there specifically for that purpose, as that date formatting is old, I'm afraid to change it to not break someone's site.

alex-shpak commented 4 months ago

Your suggestion is applied