In the last post I wrote about my considerations about what software to use for my blog, where to host it and how to set it up. This post contains some more techinical details like the git structure and the deployment process. So then let’s dive in.
The git structure Link to heading
The hugo projects mentions in their documentation to use a git submodule for the theme. Git explains that you can use this feature to integrate another project into your repository while still getting the latest commits from the other repo.
Image 1: An illustration of a git repository with an embedded submodule (source: Own image)
By doing I can fetch the latest changes made to the hugo theme I used to avoid security issues or get the latest features just by running a simple git pull
. The best thing is that you can user submodules in both directions: push and pull.
Automating the deployment process Link to heading
As good administrators are usually lazy, which means the automate recurring tasks, you can create another submodule to easily publish the latest commits directly to github pages. For the automatic deployment to github the hugo project also tells you how to do this. You just have to add another submodule to your github pages repository. As soon as you’ve finished this it’s pretty straightforward.
|
|
So as soon as I run this bash script my latest changes are directly live on github and so also on the website. Pretty simple isn’t it? This enables me to continously update my blog just by running a simple shell script.