TL;DR
This article goes throught all the details in order to explain how setup a blogfolio like this one
- From article posting using simple Markdown syntax 🔤
- To deployment on Github Pages 🚀, with Giscus comments on each articles 🗣️
- To monitoring of engagement using Goatcounter 📶
Keep reading for more !
Introduction
I’m currently starting this blogfolio to expose my work on the internet and to kick off some content on this blog about fun details I’v come accross exploring topics. It is basically a web hosted memo, but I hope it could help others tech-hobbyist exploring stuff too !
To start a first with some technical details on this fresh new website, It might be a good start to deep dive under explaining how this website is generated, from creation to deployment.
The dilemna of 🥚 VS 🐔 remains but at least we could get details of how things are done. 😃
Let’s go !
Making this kind of website - A simple HowTo
This website is made public using the fancy tool of Github Pages and the behind the scenes are curated by Hugo.
Install Hugo
The first setup of hugo is easy, install it following guidelines from previous website based on your OS.
For me, as I enjoy using an Ubuntu workstation :
sudo snap install hugo
Create template for your new website 🚀, launching it with
hugo new site <name of site> -f yml
Make a fork of your favorite Hugo theme 🌟, and then add it as a submodule it under your theme folder
git submodule add --depth=1 https://github.com/<yourGHuser>/hugo-PaperMod.git themes/PaperMod
git submodule update --init --recursive
Later, you can update layouts and customize the theme under your own repo in this git submodule.
Finally add in config.yml
:
theme: "PaperMod"
Cutomize to your liking your blog :
- Add a search and archive page
- Add a presentation page
- tweak the
assets/css/extended/themes-vars-override.css
to get a color palette at your liking - Modify options under
config.yml
to enable or disable features
You would like to add some comment system ?
- Create a “Discussions” category under your Github repository discussion tab. (Using “Announcements” is a good practice, as explained by Chris Wilson1)
- Have a look at Giscus, answer the configuration questions and then
paste the script under
layouts/partials/comments.html
. Do not forget to setcomments: true
underconfig.yml
- Now you have a fancy comment system !
What about a monitoring dashboard ?
- Sign up at Goatcounter.com, and copy the code snippet under the file
layouts/extend_footer.html
<script
data-goatcounter="https://<yoursitename>.goatcounter.com/count"
async
src="//gc.zgo.at/count.js"
></script>
- Go to your dashboard at https://yoursitename.goatcounter.com and watch traffic incoming. If you do not see any peak, disable your adblocker.
- Now you can monitor the number of views of your posts !
Create some content
I will organize my posts under a folder, split per year and month as it is displayed under archive page.
To quickly kick-off content use this script under script
folder. Inspired from Nicholas Gilbert2
#!/bin/bash
printf -v year '%(%Y)T' -1
printf -v month '%(%m)T' -1
hugo new --kind post posts/$year/$month/$1/index.md
So basically, next time you see a new blog post, it’s just a markdown containing notes samples, which is commited on my personnal repo on Github.
I can trigger an new post writing with this command
./scripts/make-post.sh new-fancy-idea
Deploy to your new website
Each time a commit reach main
branch, Github Action trigger some pipelines to build and deploy it.
You can see all details about the various step under .github/workflows/hugo.yaml
|
|
Basically Github will handle :
- Build the static sites using job at line 31, generating pages for each article.
- Deploy it using GitHub Pages environment, using job definition at line 68.
Conclusion
Hugo is a pretty fun framework to use, and well integrated with Github and other tools. Basically writing some contents is just about kicking-off some Markdown which make the release cycle so simple !
If you wish to record you blog under other Open Source ones, not hosted under a private solution like Medium or Substack, go to diff.blog
Thanks to all other bloggers for exposing their works, it makes life so much easier but doesn’t trade off under the Open Sourceness of solutions.
Happy to see other Open Source and Ad free blog around 😊