Change Jekyll URL When Git Push

August 05, 2014

1 min. read

I just don’t get it. Why should I manually set ‘url’ in Jekyll’s _config.yml to http://localhost:4000 when I’m coding and previewing locally (jekyll serve --watch) for the first place?

Luckily, I can have sed do this for me :)

cd ~/GitHub/lsfalimis.github.io &&\
sed -i.bak 's,url: http://localhost:4000,url: http://lsfalimis.github.io,g' _config.yml &&\
git add . -A && git commit -m "update" &&\
git push -u origin master &&\
sed -i.bak 's,url: http://lsfalimis.github.io,url: http://localhost:4000,g' _config.yml

I declare an alias for this in ~/.zshrc.

← Customise HPSTR Jekyll Theme

Published 07 Aug 2014

edX Linux Course Notes →

Published 04 Aug 2014