Hugo Blog Setup

Hugo is installed on webserver, blog exists in git repository in /home/djbeadle/blog.

The git repository is synchronized via GitHub, for easy editing a copy exists on my laptop.

To author a new blog post on laptop:

  1. Open MacDown
  2. Write!
  3. Save to /Users/Djbeadle/Sites/blog/content/post/[NEW-POST].md
  4. Commit [NEW-POST]
  5. ./update_blog.sh

update_blog.sh logs in to the webserver using SSH keys, updates the repository, clears the public directory and then updates it with the new content.

#!/bin/bash
git -C /Users/Djbeadle/Sites/blog push
ssh website "
    git -C /home/djbeadle/blog pull 
    cd /home/djbeadle/blog
    rm -rf /var/www/blog/*
    rm -rf /home/djbeadle/blog/public/
    hugo
    cp -r /home/djbeadle/blog/public/* /var/www/blog/
"