Install Jekyll for github pages
Install Ruby Environment
brew install rbenv
- Add
"eval $(rbenv init -)"
to the end of~/.bash_profile
- Install a ruby version
rbenv install 2.3.0
- Select a ruby version by rbenv
rbenv global 2.3.0
- Open a new terminal window
- Verify that the right gem folder is being used with
gem env home
(should report something your user folder not system wide)
Install Bundler
- Select a ruby version locally for the folder you are located in e.g.
rbenv local 2.3.0
- Verify that the right gem folder is being used with
gem env home
- Run
gem insall bundler
- Run
bunlde install
Install Jekyll
- Run
gem install jekyll
Create a new Jekyll site at ./myblog
- Run
jekyll new myblog
- Change to the folder
cd myblog
- Run
bundle exec jekyll serve
- Browse to http://localhost:4000
Connect Github
git init
git remote add origin https://github.com/username-or-organization-name/your-remote-repository-name
git add .
git commit -m "update site"
git push -u origin master
Use an old site folder ./oldblog
- Change to
cd oldblog
- Build the site and make it available on a local server
bundle exec jekyll serve
- Browse to http://localhost:4000
Install Sublime Text 3 Jekyll Editor Plugin
- Press
CMD + Shift + P
- Select
Install Package
- Search
Jekyll
and install the latest version - Change settings
Preferences->Package Settings->Jekyll->Settings-User
to add"jekyll_posts_path": "/xxx/newblog/_posts"
Write a New Post
- Select the Folder
_posts
- Press
CMD + Shift + P
- Search
Jekyll New Post
, and press Enter - Input the File Name, e.g., “The First Blog”, and press Enter
- The Plugin will rename the file following the rules automatically.
- Edit the file, and use
git
command to submit or update.
Add a Comment Section
- Create an issue under your github page project, remember the issue id.
- Add
comment_id: ##
in the head area.
Add support of Mathjax via secure https connections
gem install kramdown
- Change the markdown line in _config.yml to
markdown: kramdown
- Create a local js file named
mathjax-local.js
with script like this:
- Add the following script to
_layouts/default.html
, or to_includes/header.html
:
- Mark any mathematics in your posts within a pair of
$$
s. - A test: \(x^2\).
References:
- https://github.com/rbenv/rbenv/issues/938
- https://jekyllrb.com/docs/installation/macos/
- https://jekyllrb.com/docs/
- https://help.github.com/articles/using-jekyll-as-a-static-site-generator-with-github-pages/
- https://jekyllrb.com/docs/posts/