Info
Edit Feb 2025:
Jacky has since released an update for Quartz (
version 4) which is no longer based in Hugo/gGolang, but rathernode.js.Migration is super simple, and it’s provided a syntax convenience that is much easier to work with so far — check it out here or go through the hosting docs to configure
v4from scratch.
- To sync local to the remote repo, you simply run
npx quartz sync.- If you end up appreciating the project as I have, consider making a one-off (or more) sponsor!
It’s been a backlog priority of mine for a while now to start writing online. As someone who has been working with a second brain/PKM system for a while now (Notion & Obsidian), I figured a solution that can leverage that personal written content for the purpose would be ideal:
- Note-taking is part of my natural way of working - this means I passively generate content, and perhaps through integration, writing online could also feel as frictionless.
- Both apps are written in native markdown content, making translation to web pages easy.
- The value of each resource is substantial, but integrated, the resulting personal ecosystem could be way greater.
I decided instead to stand on the shoulders of jackyzha0 ‘s incredible Quartz repo as the touchstone, and adapt my solution from there.
In the event it’s useful for others, here are the steps I took to get it all going. It involves:
- The Quartz Repository, by Jacky Zhao
- An existing Obsidian Vault
- A particularly useful related plugin is Waypoint, for generating MOC pages.
- GitHub Pages for hosting
- And a little scripting for quality of life changes.
Linux (ubuntu) installation:
Firstly, fork and clone the following repo locally:
https://github.com/jackyzha0/quartz
1. Install Hugo:
Quartz runs on top of Hugo, so we’ll need to independently install it. For me, this was on linux, but hugo has documentation for installation on other OS’s too.
sudo snap install hugo
2. Install Hugo-obsidian + Go dependencies, if required:
-
Install go if not already installed on system.
- Make sure go version is (>= 1.16).
- Go installation page
-
Initialise a new go module for project, using github repo URL. e.g
go mod init github.com/Blamechance/blamechance.github.io
If you experience path issues, indicated by command not found errors:
a. Confirm where GO installed itself (normally in `~/[user]` folder).
b. Edit or create `.bash_profile` file in user directory.
c. Add the following line to the file, e.g:
export PATH="$HOME/go/bin:$PATH"
Run the following to load the edited config to current shell (you might need to restart your app if operating terminal in something like vscode for same effect):
source ~/.bash_profile
-
Install
hugo-obsidianto enable backlink conversion, for local site live previewing:a. Get the modules required:
go get github.com/jackyzha0/hugo-obsidianb. Install from repo:
go get go install github.com/jackyzha0/hugo-obsidianc. Test with:
hugo-obsidian version -
To run, navigate to the folder where quartz was cloned and run:
make serve
3. Copy obsidian/markdown files to quartz
-
Navigate to the desired obsidian folder to upload.
- I set up my vault to have a
publicand aprivatefolder. - My workflow for now will involve working in obsidian, and logically considering the
publicfolder the space where I move notes I want to share. - All notes/posts will be edited and created through the obsidian → export process, with the only elements needing editing within an IDE being the index file, CSS, html etc.
- I set up my vault to have a
-
Copy the folder into the
contentfolder in your quartz directory. -
That’s it! Run
make serveto view your website locally, and push to your github repo to host it on Github pages.
Automating export:
Using a naive quick and dirty bash script to clears the repo’s copy of the vault and index files, to copy in the current ones from the obsidian vault location.
Automating this process means the creation process of posts is simple:
- Write/edit posts and index file as notes in obsidian
- Run
make serveto host local render of website. - Run script in terminal to update the browser render live.
- To post, push on git!
e.g
#!/bin/bash
#!/bin/bash
SOURCE_PATH=/home/tommy/Documents/obsidian_blamechance_wiki/Digital-Cottage
DESTINATION_PATH=/home/tommy/Documents/digital-cottage/content
echo "Remember to delete/edit the index.md before running script!"
read -p "Press Enter to continue or Ctrl+C to cancel..."
rm -rf "$DESTINATION_PATH"/*
cp -r "$SOURCE_PATH"/* "$DESTINATION_PATH"
References:
Resources:
- https://github.com/jackyzha0/quartz
- https://quartz.jzhao.xyz/notes/hosting/
- https://quartz.jzhao.xyz/notes/troubleshooting/
- https://quartz.jzhao.xyz/notes/config/
- https://docs.github.com/en/pages/quickstart
- Publishing your Vault Online With Quartz - Brandon Boswell
- I found this method to have a few too many gaps in instruction to replicate his home brewed solution. It did however, introduce me to the Quartz repository.