Closed xiaopxiaop closed 7 years ago
It's possiblely related to how the theme parses the date, which theme are you using? can you provide the theme repo url?
I tried two theme, next & landscape, and both had the same issue. So I guess it's not related to theme, but hexo itself.
BTW, when I changed the title from 2015-10-11 to "2015-10-11", the problem was gone.
This is irrelevant to the theme.
The hexo post front-matter must conforms to either JSON or YAML. In YAML, the date type is represented as 2015-12-01
. So what you write in the front-matter
title: 2015-10-11
date: 2017-10-03
is equivalent to:
{
title: new Date("2015-10-11"),
date: new Date("2017-10-03")
}
The title is converted to string using moment().format
, thus is displayed as Sun Oct 11 2015 00:00:00 GMT+0800 (中国标准时间)
If you would like to have the string 2015-10-11
as title, go as
title: '2015-10-11'
date: 2017-10-03
It is interesting to note that hexo g 2015-10-11
does escape the title as string.
Hexo should have check the schema of front matter and throws error. But I'd rather keep things simple and leave it won't fix.
Environment Info
Node version(
node -v
): v6.11.3Your site
_config.yml
(Optional):Your theme
_config.yml
(Optional):Hexo and Plugin version(
npm ls --depth 0
):+-- hexo@3.3.9 +-- hexo-asset-image@0.0.3 +-- hexo-deployer-git@0.3.1 +-- hexo-deployer-heroku@0.1.2 +-- hexo-deployer-openshift@0.1.2 +-- hexo-deployer-rsync@0.1.3 +-- hexo-generator-archive@0.1.4 +-- hexo-generator-category@0.1.3 +-- hexo-generator-feed@1.2.2 +-- hexo-generator-index@0.2.1 +-- hexo-generator-searchdb@1.0.8 +-- hexo-generator-sitemap@1.2.0 +-- hexo-generator-tag@0.2.0 +-- hexo-renderer-ejs@0.3.1 +-- hexo-renderer-marked@0.2.11 +-- hexo-renderer-stylus@0.2.3 +-- hexo-server@0.2.2 +-- htmlparser@1.7.7 `-- match-words@1.0.0
For BUG
A sample post 2015-10-11.md is as follows:
when viewing it on the browser, the title was changed to
Sun Oct 11 2015 00:00:00 GMT+0800 (中国标准时间)
However changing the title to 2015-10-9 in md file would make the post appear normal.