我使用hugo创建了一个帖子new posts/mypost.md,它为我创建了mypost.md,其标题toml配置如下
但是,当我在服务器(本地)上运行时,日期时间呈现错误,例如:

我该如何解决这个问题?提前致谢!
这就是我让它工作的方式:
添加您的日期格式config.toml
[params]
dateFormat = "02 Jan 2006"
Run Code Online (Sandbox Code Playgroud)
您的帖子应在其标题中包含日期:
---
date: "2020-12-23T15:21:54+05:30"
...
---
Run Code Online (Sandbox Code Playgroud)
在布局中使用格式:
<div>{{ .Params.date.Format .Site.Params.dateFormat }}</div>
Run Code Online (Sandbox Code Playgroud)
注意:请不要更改日期格式中的数字。日期必须是 02,月份必须是 Jan,年份必须是 2006,等等。请检查此以了解更多详细信息。
另请查看Hugo 0.87(2021 年 8 月,两年后),其中包含:
\n时间日期格式
\n{{ time.Format "Monday, Jan 2, 2006" "2015-01-21" }} \n\xe2\x86\x92 \n"Wednesday, Jan 21, 2015"\nRun Code Online (Sandbox Code Playgroud)\n\n\n请注意,从 Hugo 0.87.0 开始,
\ntime.Format将返回当前语言的本地化字符串。
日期/时间格式布局
\n{{ .Date | time.Format ":date_long" }}\nRun Code Online (Sandbox Code Playgroud)\n自定义布局的完整列表以及英语示例:
\n:date_full => Wednesday, June 6, 2018\n\n:date_long => June 6, 2018\n\n:date_medium => Jun 6, 2018\n\n:date_short => 6/6/18\n\n:time_full => 2:09:37 am UTC\n\n:time_long => 2:09:37 am UTC\n\n:time_medium => 2:09:37 am\n\n:time_short => 2:09 am\nRun Code Online (Sandbox Code Playgroud)\n