Since I use hexo as my new blogging tool, I like it very much, it’s much more faster than wordpress, and markdown is more suitable for a programmer. But the only inconvenient thing is the posting experience, I have to upload new posts to the server and run hexo generate manually to publish a new post, I want the feature of writing on multi-platform.

And fortunately, there is a solution using dropbox with hexo, it can be done easily.

Install dropbox dameon on your server


Just follow the instruction on dropbox site:

1
2
wget -O - https://www.dropbox.com/download?plat=lnx.x86_64 | tar xzf -
~/.dropbox-dist/dropboxd

Usually, I run dropbox dameon with screen command.


Make a symlink of your posts folder or entire site.

1
ln -s /path/to/hexo/folder/ ~/Dropbox/folder/name

I recommend just sync your posts folder, not entire hexo folder, because when hexo generates new posts, it will make changes to many files, cause dropbox to sync with too many files. If you make changes to your posts too fast, it may cause conflicts while syncing.

Make hexo watch your changes of posts


It’s easy with –watch option:

1
hexo generate --watch

It’s done then, now I can write on all of my devices, dropbox will automatically sync, and hexo will generate automatically. Although this post mentioned that hexo(with –watch option open) plus drop box eat a lot memory, but I tested it on my VPS, it only use about 200m, it’s ok to me.


Comments

2014-03-05