为什么hexo生成的文件日期是1970

时间:2021-05-16 08:29:41

标签: time hexo

我最近正在使用 hexo 建立一个博客,但 hexo -g 生成的帖子的日期是 1970 年:

(base) root@DESKTOP-7SU7LQD:/mnt/d/Blog_2# ls source/_posts/
hello-world.md
(base) root@DESKTOP-7SU7LQD:/mnt/d/Blog_2# hexo g
...
INFO  Generated: 1970/01/01/hello-world/index.html
INFO  37 files generated in 2.65 s
(base) root@DESKTOP-7SU7LQD:/mnt/d/Blog_2# ls public/
1970  404.html  about  archives  categories  css  img  index.html  js  lib  links  local-search.xml  tags  xml

我该如何处理这个问题?

1 个答案:

答案 0 :(得分:1)

你能展示一个源文件,一个帖子吗?

如果没有进一步的细节,很可能是遗漏了 front matter “编译”不是必须的,但在文件从 Markdown 到 Yaml 再到 Html 处理时可能会导致问题。

这将有助于分离文件

---
title: Hello World
date: 2013/7/13 20:46:25
---

另一种解决方案是使用 https://hexo.io/docs/variables#Page-Variables :momentjs' date_updated 页面变量 这似乎更有可能切中要害 enter link description here

您需要使用 updated_option: 'date'

编辑:第二个解决方案

相关问题