Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localize post meta dates #325

Merged
merged 2 commits into from
May 31, 2023
Merged

Localize post meta dates #325

merged 2 commits into from
May 31, 2023

Conversation

Vimux
Copy link
Owner

@Vimux Vimux commented May 31, 2023

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