UlyssesZh / UlyssesZh.github.io

Ulysses Zhan's blog!
https://UlyssesZh.github.io
MIT License
3 stars 3 forks source link

Running Jekyll myself | Ulysses’ trip #50

Open UlyssesZh opened 1 year ago

UlyssesZh commented 1 year ago

https://ulysseszh.github.io/programming/2020/04/13/run-jekyll-myself.html

It is an annoying thing that I cannot add custom plugins if GitHub pages runs Jekyll for me. Thus, I need to build the site myself and let GitHub pages to present my built site. Note that GitHub pages serving personal users cannot present the site deployed in docs dir of master branch or in root of gh-pages branch, so I need to put my Jekyll source in the development branch, and push the built site to the master branch when I think it is ready to be published. I have written a script to do it for me: MESSAGE=$1 echo "Committing..." git commit -m "$MESSAGE" --author "$AUTHOR" echo "Backing up..." mv _site/.git git_backup echo "Building..." jekyll build --quiet echo "Restoring..." mv git_backup/.git _site cd _site echo "Pushing..." git add -- */ git commit -m "$MESSAGE" --author "$AUTHOR" git push --set-upstream origin master where AUTHOR is your name and email in the format name . Before that, I need to initialize the site dir as a git repo: cd site git init git remote add origin $REMOTE_URL git add -f -- */ git commit -m "initial commit" git push -f --set-upstream origin master where REMOTE_URL is the GitHub url of the repo of your site.