Make hexo sync with dropbox
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.
Just follow the instruction on dropbox site:
wget -O - https://www.dropbox.com/download?plat=lnx.x86_64 | tar xzf -
Usually, I run dropbox dameon with screen command.
Make a symlink of your posts folder or entire site.
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.
It’s easy with –watch option:
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.