Migrate Blog to Octopress
For basic configuration of octopress blog, go to official site for references.
Issue with OS EI Caption (10.11)
After updating OS to EI Caption (10.11), there is some bugs when we run
rake preview. You need to update your ruby version, and reinstall dependencies of octopress.
Refer to Errno::ENOENT: No Such File or Directory - Jekyll ~ Octopress and El Capitan post for more details.
If you can still not update your ruby version using the way in the above post, try the following commands (Refer to Using Rbenv to Manage Multiple Versions of Ruby for more details.) before install new ruby version:
- Add rbenv init to your shell to enable shims and autocompletion:
- Restart shell as a login shell so that the PATH changes take effect:
Go to here to choose the theme you like. Personally, I like the boldandblue theme. It is simple and elegant.
this is code
this is code
Go to here, and the guy tells you how to enhance your blog to display the categories.
code syntax highlight
Refer to my previous post on write post for project pages (gh-pages) How to Write Post in Github Pages
- go to source branch.
- in hongchaozhang.github.io folder, run
rake new_post["title"], and you will find a well named file with
mdas the extension. Open it and edit.
Note:The url of post is generated from the post file name in _post folder, and you shouuld only use English charactors there. But inside your site, the title comes from the
titleproperty in the yaml header of your post, and other languages are supported here.
published: falsein the yaml header to disable your post from being displayed in the blog.
rake setup_github_pagesif you haven’t run it.
This command help you do the followings:
- Ask for and store your Github Pages repository url.
- Rename the remote pointing to imathis/octopress from ‘origin’ to ‘octopress’
- Add your Github Pages repository as the default origin remote.
- Switch the active branch from master to source.
- Configure your blog’s url according to your repository.
- Setup a master branch in the _deploy directory for deployment.
rake generateto generate your new post.
rake previewto start local server at localhost:4000 for testing.
- If everything is OK, run
rake deployto push the generated site in _deploy to master branch in github (Do it in source branch). In a second, you will see the changes at username.github.io.
If you meet with the following error while pushing your site to master branch:
To email@example.com:hongchaozhang/hongchaozhang.github.io.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'firstname.lastname@example.org:hongchaozhang/hongchaozhang.github.io.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Go to _deploy folder, and run the following commands (reference):
git config branch.master.remote origin git config branch.master.merge refs/heads/master git pull
For some times, I just run the following:
git pull origin master
- push your source code to source branch.
Note: Never push your source code to master branch. master branch should only hold your site.