klugjo / hexo-theme-clean-blog

Hexo implementation of Clean Blog http://blackrockdigital.github.io/startbootstrap-clean-blog/index.html
MIT License
402 stars 130 forks source link

Ignores Date in Front-matter #5

Closed nronnei closed 8 years ago

nronnei commented 8 years ago

Beautiful theme, love the way it looks. Slick and simple.

One thing that frustrates me is the inability to set a date for a post. I'm trying to write posts about articles published in academic journals and I want the date to reflect when the article was published, not the day I'm writing about it. I've tried specifying a date in the front-matter in several formats to no avail.

klugjo commented 8 years ago

Hi,

I can't reproduce your issue. I have no problem specifying dates retrospectively.

This is what I am using in the front-matter of my post:

title: Hello World
date: 2013-12-24 17:49:32
tags: ["Hexo"]
---

Have you got the latest version of hexo ?

nronnei commented 8 years ago

Hexo Version results:

hexo: 3.2.0
hexo-cli: 1.0.1
os: Linux 3.19.0-56-generic linux x64
http_parser: 2.5.2
node: 4.4.1
v8: 4.5.103.35
uv: 1.8.0
zlib: 1.2.8
ares: 1.10.1-DEV
icu: 56.1
modules: 46
openssl: 1.0.2g

Running v4.4.1 of NodeJS. When I run hexo serve after including the exact date tag you gave above, this is what I get:

INFO  Start processing
ERROR Process failed: _posts/srtm-lc-2006.md
TypeError: Cannot read property 'offset' of null
    at Object.exports.timezone (/home/ronneini/web/test/node_modules/hexo/lib/plugins/processor/common.js:44:40)
    at /home/ronneini/web/test/node_modules/hexo/lib/plugins/processor/post.js:83:42
    at tryCatcher (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:500:35)
    at Promise._settlePromise (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:629:18)
    at PromiseArray._resolve (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise_array.js:125:19)
    at PromiseArray._promiseFulfilled (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise_array.js:143:14)
    at PromiseArray._iterate (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise_array.js:113:31)
    at PromiseArray.init [as _init] (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise_array.js:77:10)
    at Promise._settlePromise (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:557:21)
    at Promise._settlePromise0 (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:629:18)
    at PromiseArray._resolve (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise_array.js:125:19)
    at PromiseArray._promiseFulfilled (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise_array.js:143:14)
    at Promise._settlePromise (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:565:26)
    at Promise._settlePromise0 (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:629:18)
    at Promise._resolveCallback (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:424:57)
    at Promise._settlePromiseFromHandler (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:515:17)
    at Promise._settlePromise (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:684:18)
    at Promise._fulfill (/home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/promise.js:629:18)
    at /home/ronneini/web/test/node_modules/hexo/node_modules/bluebird/js/release/nodeback.js:42:21
    at /home/ronneini/web/test/node_modules/hexo/node_modules/hexo-fs/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.

Also, the post doesn't render after changing the date but all other posts render just fine.

klugjo commented 8 years ago

Hi Mate,

Thanks for the logs.

1) It appears that the issue is due to the timezone management and not the date format.

Can you check the timezone: value in your config (the main _config.yml at the root of the blog) ?

If should not be something like +08:00 or en-US but configured as a momentJS timezone name:

something like:

The full list of values can be seen here: http://momentjs.com/timezone/

2) Another thing you can try is use

$ hexo new "test post"

to create a new post and see how Hexo generates it. Then see if that works and reuse the same format.

Keep me posted.

nronnei commented 8 years ago

This did the trick, thank you! Had timezone set incorrectly.