Skip to content

Localize post meta dates#325

Merged
Vimux merged 2 commits into
masterfrom
localize-post-meta-dates
May 31, 2023
Merged

Localize post meta dates#325
Vimux merged 2 commits into
masterfrom
localize-post-meta-dates

Conversation

@Vimux

@Vimux Vimux commented May 31, 2023

Copy link
Copy Markdown
Owner

This PR added post meta dates localization with time.Format function (via dateFormat alias). Hugo v0.87.0 or later is required. The default date format is unchanged to preserve compatibility.


With Hugo v0.87.0 (or later), date meta field shows localized dates (with weekdays and months in the current language) by default. In most cases, such a transition is painless, but owners of multilingual sites should be careful and check that everything translates as expected after the upgrade.

You can also use a predefined layout, like :date_full, and it will output localized dates or times. For additional information about localized dates and possible date/time formatting layouts, please see Hugo: time.Format.

Fixes #318

Vimux added 2 commits May 31, 2023 03:18
* Use time.Format function (via `dateFormat` alias) to format post meta dates. It allows dates to be localized easily (with weekdays and months in the current language). Hugo v0.87.0 or later is required.
* Use old default format to preserve compatibility with older versions of Hugo

References:
- https://gohugo.io/functions/dateformat/
- https://gohugo.io/news/0.87.0-relnotes/
@Vimux Vimux merged commit 4c82ea8 into master May 31, 2023
@Vimux Vimux deleted the localize-post-meta-dates branch May 31, 2023 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant