Publishing an Obsidian Vault to a Website with Quartz

Publishing an Obsidian Vault to a Website with Quartz

In this post, I’ll show you how to add your Obsidian notes or entire vault to your website for free. This way, you can easily share them with the world. I’m planning to post some Obsidian notes on my blog in the future, so I thought I’d also share/document the process.

Obsidian stores your notes as plain Markdown in a plain folder. We’ll be using Quartz to convert it to an HTML site you can upload to a web server. I made an example site here if you want to check it out. 

Note: Things like dataview queries, plugins (Excalidraw, Kanban, etc.) and canvas files will not get exported.

Step 1 — Install Quartz

Quartz is used by cloning it, not by installing it as a dependency. Your site lives inside the clone.
git clone https://github.com/jackyzha0/quartz.git my-site
cd my-site
npm install
  • content/ — your vault goes here
  • quartz/ — the generator itself
  • public/ — build output; this is the website
  • quartz.config.ts — what the site is
  • quartz.layout.ts — where things sit on the page

Step 2 — Get your vault into content/

Everything under content/ becomes the site. There are three ways to put it there, and the right one depends on how you work.

Simplest, just Copy it.
cp -r "/path/to/Your Vault" content/
Symlink it. Your vault stays where Obsidian expects it, and Quartz reads it live.
New-Item -ItemType SymbolicLink -Path "content\vault" -Target "C:\Users\you\Documents\Obsidian Vaults\Your Vault"

Make the vault a git submodule. If your vault is a git repository. 

git submodule add https://github.com/you/your-vault.git content/vault

Step 3 — Configure the site

Add this to quartz.config.ts.
configuration: {
  pageTitle: "eecs.blog",
  baseUrl: "eecs.blog/obsidian/publish-example",
  ignorePatterns: ["private", "templates", ".obsidian"],
  analytics: null,
}

Note: For the baseUrl don’t include the protocol or trailing slash, so in my case eecs.blog, not https://eecs.blog/. It can include a path if your site lives in a subdirectory.

Step 4 — Decide what to publish

If you don’t want to publish something, you can exclude it like so:

Per-note, by frontmatter. Add draft: true and the note is dropped at build time:
---
title: Half-finished thoughts
draft: true
---
Per-folder, by config. Anything matching ignorePatterns is never read:
ignorePatterns: ["private", "templates", ".obsidian", "Daily Notes"]
Or simply don’t copy the content into content/

Step 5 — Preview it locally

You can open the preview on http://localhost:8080.
npx quartz build --serve

Step 6 — Build

npx quartz build
This writes the finished site to public/. That folder is a self-contained HTML, CSS, JS, images, an RSS feed and a sitemap.

Step 7 — Deploy

Now simply upload the contents of public/ to your web server.

If you will be deploying the notes into a subdirectory of an existing WordPress site(like I did), WordPress “swallows” your URLs. Its rewrite rules hand every path that is not a real file to index.php. Quartz emits about.html, not about/index.html, so a link to /about is not a real file and WordPress throws a 404.

To fix it, declare a RewriteEngine in a child .htaccess that replaces the parent’s rules for the whole subtree:

Contents of the .htaccess file you need to upload in the same directory as your files.
RewriteEngine On
RewriteBase /obsidian/publish-example/

# Quartz emits about.html, not about/index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html [L]

ErrorDocument 404 /obsidian/publish-example/404.html

Step 8 — The Final Result​

The example site, live and interactive — try the search, the graph, or a wikilink. Open it in its own tab →

Leave a Reply

Your email address will not be published. Required fields are marked *

The following GDPR rules must be read and accepted:
This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you will get more info on where, how and why we store your data.