Zyck's blog
built with github Pages with jekyll
write something worth recording visit https://qzyse2017.github.io to view the blogs.
How to reuse the site's page layouts
- clone this repo
git clone https://github.com/qzyse2017/qzyse2017.github.io
-
remove
*.mardown
files in_posts
directory -
write some post files yourself in
_posts
directory, you can refer to the format like any file in_posts
directory -
configure settings in
_config.yml
, you may refer to this current site and change the corresponding parts in_config.yml
-
generate files to be showed under WSL and Linux, enter this repo which you have cloned and configured and written some new posts
run command bundle exec jekyll serve
preview your local Jekyll site in your web browser at http://localhost:4000.
I haven't tried how to get it done under windows or osx, you may refer to this help page in GitHub.
- you may also need to remove some other files like
genContent.py
and files under_site/daily_posts
Generate contents automatically while committing
Although jekyll default template provides some code to generate contents while building the website, I did not notice it and wrote a simple script to generate contents myself: genContent.py
and I now added a gt hook to automatically start it every time I use git commit
, if you also want to have a try:
- copy the following code and name it
pre-commit
- put it under a git inited directory,
dir-name/.git/hooks/
, and you want to prevent it from working, usegit commit --no-verify
- use
git add <you-new-added-file-name-here>
- if you do not add new posts, it is recommended that you use
git commit --no-verify
#!/bin/sh
if [ -n eval $(python genContent.py)]
then
git commit content.md -m 'Renew content' --no-verify
else
# Handle error
echo >&2 "Found error while generate contents, will execute normal commit without generating new contents"
fi
exit 0
Note:
-
if any error occurred, you can use
git reflog
to list all you operations and usegit reset --hard <status-sha1>
here to reset your status. -
In fact the pre-commit hook will only commit changes in
content.md
, so you do not need to care about other files' changes will be included.