Why the date of the file generated by hexo is 1970

Viewed 95

I’m using hexo to build a blog recently, but the posts generated by hexo -g have date of 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

How can I handle this problem ?

1 Answers

Can you show a source file, a post?

Without further details, it's very likely a missing front matter It is not mandatory for "compilation" but it may cause issues later when files are processed from Markdown to Yaml to Html.

It will help to separate files

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

Another solution would be to use https://hexo.io/docs/variables#Page-Variables : momentjs' date_updated page variable which seems to be more likely to the point enter link description here

You would need to use updated_option: 'date'

EDIT: 2nd solution

Related