I want to write in a clean workspace, that only includes plain text (such as: markdown file) and assets referenced in articles.
Gem-based Jekyll theme is a good choice but Github doesn't support customized theme now (Supported theme list).
Blogs and Jekyll pages separation solution
My site is separated into three parts:
- Blogs - Only include markdown files and assets (also support gem-based theme)
- Gravid - A simple and beautiful jekyll theme.
- Jekyll pages - Above two parts are included by
git submodule, and this repo just link important files for Jekyll pages.
How to do
- Add submodules to Jekyll site.
git submodule add -b blogs https://github.com/zddhub/zddhub.github.io .blogs git submodule add -b master https://github.com/zddhub/gravid .gravid
- Symlink important files to Jekyll site.
ln -s .blogs/posts _posts ln -s .blogs/assets assets ln -s .blogs/journal journal ln -s .blogs/about.md about.md ln -s .blogs/archive.md archive.md ln -s .blogs/index.md index.md ln -s .blogs/_config.yml _config.yml mkdir -p _includes # the symlinked files under `includes` cannot be used. ln -s .gravid/_layouts _layouts ln -s .gravid/_sass _sass ln -s .gravid/404.html 404.html
- Clone repo with submodules (once at first time)
git clone --recursive https://github.com/zddhub/zddhub.github.io.git
- After you updated and pushed Blogs or Gravid, run
./publish_blogto trigger Jekyll pages on Github side.
If Github page supports customized theme later, or in your local environment, You can use gem-based style.
git clone https://github.com/zddhub/zddhub.github.io.git -b blogs
And add this line to your Jekyll site's
And then execute:
Or install it yourself as:
$ gem install gravid
bundle exec jekyll serve and open your browser at
If you want debug in local (master branch) with
jekyll server --watch, you will find some INFO like this:
** ERROR: directory is already being watched! **
Don't worry, this is just a Warning.
If you have any question or idea, please email to me.