Skip to content

Instantly share code, notes, and snippets.

@wtsnjp
Created November 23, 2016 07:43
Show Gist options
  • Save wtsnjp/b90eef5df96c87d7172a96b6408d7d63 to your computer and use it in GitHub Desktop.
Save wtsnjp/b90eef5df96c87d7172a96b6408d7d63 to your computer and use it in GitHub Desktop.
# Functions for Hugo
local BLOG_PATH=~/repos/blog.wtsnjp.com
function hg-new() {
cd $BLOG_PATH
hugo new post/$1.md --editor="macdown"
}
function hg-preview() {
cd $BLOG_PATH
open "/Applications/Google Chrome.app" http://localhost:1313
hugo server -D -w
}
function hg-publish() {
cd $BLOG_PATH
hugo undraft content/post/$1.md && hugo
cd $BLOG_PATH/public
git add -A && git commit -m "publish $1"
git push origin gh-pages
cd $BLOG_PATH
}
function hg-update() {
cd $BLOG_PATH
hugo
cd $BLOG_PATH/public
git add -A && git commit -m "only update"
git push origin gh-pages
cd $BLOG_PATH
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment