Blogging with Hugo and Obsidian
Jan 13, 2024
The days of decetralized web are obver, since so called web 2.0 everyone just moved to the dystopian shared community platforms so called social media. Thus we are going forward web 3.0 is getting 1000x times worse. The evil is winning, and the opposition will not stand long.
You absolutely need an website, for many resons and for manny diffrent stuff, soner or later not having one will bit you in the ass, and it’s usually pretty bad time wheen you are managing all your buissnes as Facebook page.
Using some dumb service like wix or squarespace is an insult to you and the viewer, and it only develop bad habits. WordPress due it’s questionable buisness strategy has become what it become and I no lonfer can recommend it. Fortunatelly there are framworks that resolve all the issues with creating an website from scratch with pute HTML, CSS and Java framework. and they are extremly approachable for people with just a little technival knowledge.
Prequisition
Installation
- Install Hugo (extended edition, v0.112.0 or later)
- Install Git
- Install VSCodium (FOSS alternative for VS Code)
Hugo
Theme
No need to start from scratch, there is plenty go themes, chose something and tailor it it for your needs later on.
Creating website
https://gohugo.io/getting-started/quick-start/
hugo new site quickstart
cd quickstart
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo "theme = 'ananke'" >> hugo.toml
hugo server
- Create new site
- Clone template with submodule
- Copy template page and config
- Run Hugo server
- Modify as you like
GitHub
After creating a website connect it to the GitHub repo.
Cloudflare
Domain
Obtain domain I use namecheap for that, you can get .xyz .art for as cheap as $2/yr
DNS
Connect you domain name to Cloudflare
Deployment
Using Cloudflare Pages you can deploy static websites for free. Use Hugo builder.
Analytics
Cloudflare – For basic analytics it’s enough, simple 2 click set-up in the analytics page
Google Analytics 4 – Create new project → manual install → put tag into on bottom of the file layouts/partial/head.html
, just before </head>
Obsidian
Folder synchronization
We want to write in Obsidian, and have changes done in blog folder, opening the website directory, isn’t really all that great option. So we want to synchronize the files from one folder to another.
- Create a blog folder in your Obsidian vault.
- Open the folder in the terminal
- Create symlink for both content and img directory.
ln -s /home/restorimo/Hugo/restoblog/content content
ln -s /home/restorimo/Hugo/restoblog/static/img static
Now any changes made in Obsidian will translate into .md edit inside blog folder
Template
Using templater plugin you can set template for new note in /content/ folder, for example looking like this:
---
title:
date:
draft: true
image:
description:
tags:
---
Git
As you’ve done all the changes you wanted is good to push it to the repo
CLI
git add *
git commit -m "(name of commit)"
git push
VSCodium
Using git inside terminal is more complicated that it should be so maybe, instead try build git GUI inside VSCodium. It shows all changes, and allows for simple pushing and pulling using buttons instead commands.
Obsidian
There are plugins like obsidian-git, might be actually useful for that.