Background
In this post I talked about moving my hosting to GitHub Pages. I was happy with the setup, but I missed some features that I had with my original setup. I decided to move back to my original setup.
Why I moved back
GitHub Pages is a good solution for some people, you push to the repo and your site gets updated, But it wasn’t for me. I missed some features that I had with my original setup like:
- Can’t upload drafts: I’m writing more and more write-ups and some of them cannot be published until the machine is retired. It was a pain if I wanted to update my website while I had a draft in my repo. I couldn’t push the drafts because they would show up in the repo and therefore be public. Now I can push what I want and make the drafts accessable through URL and not through the website.
- Access logs: The access logs give me more information about the visitors of my website than the Simple Analytics I’m using. This gives me more control over what’s happening on my website.
My current setup
In my original setup I used to just drag and drop the files to the server. Now I’m using a small bash script that compiles my Hugo website and uploads it to the server. I can now just run ./deploy.sh
and my website is updated.
I used to use the -D
flag to compile “darfts” as I was using that “withheld” posts. This wasn’t very efficient since I wasn’t able to use draft in it’s intended way. I just added a different tag to those posts which tells Hugo to compile them and I could make sure they weren’t public.
This is the script I use:
#!/bin/bash
echo "Building..."
hugo --gc --minify --cleanDestinationDir --quiet
if [ $? -ne 0 ]; then
echo "Build failed"
exit 1
fi
echo "Uploading..."
rsync -avzq --delete public/ <SSH Connection> 1>/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo "Upload failed"
exit 1
fi
echo "Finished!"
It’s very simple and it works for me. I’m happy with my current setup and I don’t think I’ll move again.