Minimal blogging using Hugo
I wanted to start a personal blog, but I had a specific set of non-negotiables. My website needed to be:
100% Free: No monthly subscriptions (except domain name purchase).
Minimalist: I just want to write in Markdown.
Blazing Fast: Instant loading times were a must.
I achieved all of this using Hugo and GitHub Pages. You can see the result live at prasenjeet.dev.
If you want a similar setup that costs nothing and requires zero maintenance, follow the tutorial below.
Step 1: Install Hugo
Begin by installing Hugo on your system. If you’re using Fedora, you can easily install it using the terminal:
sudo dnf install hugoFor other operating systems, refer to the official installation guide on the Hugo website.
Step 2: Create a New Hugo Site
Once Hugo is installed, create a new Hugo site using the following command:
hugo new site blog -f ymlThis will generate a basic Hugo site structure with default directories.
Step 3: Choose a Theme
Next, download a theme for your blog. In this tutorial, we’ll use the “paper” theme but you can use any other themes, personally I like hextra, but paper theme is more easy to setup for this tutorial:
git submodule add https://github.com/nanxiaobei/hugo-paper themes/paperAfter adding the theme, update the configuration file (config.yml) to set the theme to “paper”.
Step 4: Create a Demo Post
Create a demo post to test your setup:
hugo new posts/test.mdStep 5: Set Up GitHub Repository
Create a new repository on GitHub with the name “blog”. Then, initialize the local repository and push the files to GitHub:
echo "# blog" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/<your-github-username>/blog.git
git push -u origin mainStep 6: Configure GitHub Pages
Navigate to the settings of your GitHub repository and access the “Pages” tab. Choose GitHub Actions as the build and deployment method, and select Hugo as the workflow. Click the green “Commit changes” button after the YAML file is generated.
Step 7: Sync Local and Remote Repositories
Before making any further changes locally, synchronize your local repository with the remote one by running git pull.
Step 8: Update Configuration
Update the baseURL in the config.yml file to reflect your GitHub Pages URL, you can also add custom domain here. Here’s an example of the config.yml file contents:
baseURL: "<enter your link from GitHub Pages section in the settings>"
languageCode: en-us
title: Blog
theme: paper