Obsidian Digital Garden
Obsidian Digital Garden
How notes from this vault become the site at https://triphan2k3.github.io.
Architecture
flowchart LR
subgraph Obsidian["Obsidian vault (source of truth)"]
Notes["Notes, CSV tables
+ attachments"]
end
Notes <-- "Anki CSV Sync plugin
(AnkiConnect)" --> Anki["Anki
decks for review"]
Notes -- "Digital Garden plugin
(GitHub API)" --> Repo["GitHub repo
triphan2k3.github.io"]
Repo -- "GitHub Actions
deploy.yml" --> Pages["GitHub Pages
triphan2k3.github.io"]
Notes -. "obsidian-git" .-> Backup["GitHub repo
triphan2k3/obsidian"]Everything is written once, in Obsidian. Anki can also send cards back (pull), but the site only receives copies.
Obsidian
- The vault is the only place content is edited. Anki cards and web pages are generated from it.
- Backed up with the obsidian-git plugin to the repo
triphan2k3/obsidian. - Table-like data lives in CSV files next to the notes (e.g.
21. Application/Cube/db.csv, one row per case). Notes show them with a normaldataviewquery,FROM csv("path/to/file.csv"), e.g. the tables in Cube. Avoiddataviewjsfor published tables: it is published as Obsidian-rendered HTML, so images point toapp://paths and break on the site.
Anki
- The local plugin Anki CSV Sync (
.obsidian/plugins/anki-csv-sync) talks to Anki through the AnkiConnect add-on. Anki must be running. - Each CSV row is one Anki note:
anki_nid,deck,model,tags, plus one column per card field (Front,Back, ...). Other columns are ignored by Anki. - Commands:
- Pull Anki deck into CSV: adds/updates rows by
anki_nid(Anki wins for those fields); your own rows and columns are kept. - Push CSV to Anki: updates notes that exist (review history kept), creates the rest and writes their
anki_nidback. Rows with an emptydeckare skipped. - Push CSV to Anki (dry run): shows what would change.
- Pull Anki deck into CSV: adds/updates rows by
- Field text is plain text; line breaks become
<br>, and!150uploads the image and becomes<img>. - Current decks:
Cube::*from21. Application/Cube/db.csv(57 rows with a deck; OLL/PLL rows have none yet) andL_vimfrom21. Application/Vim/vim.csv. - Don't rename or clear
anki_nid, or the next push creates a duplicate card. - Review happens in Anki. Learning progress (
status) is updated manually.
GitHub Pages
- The Digital Garden plugin commits notes marked
dg-publish: trueto the repotriphan2k3/triphan2k3.github.io. - Each push to
masterrunsdeploy.yml(Eleventy build), which deploys to GitHub Pages. - Publishing is one-way: the site never writes back to the vault.
How it works
- The Digital Garden plugin compiles marked notes and commits them to the GitHub repo
triphan2k3/triphan2k3.github.io(branchmaster). - Notes land in
src/site/notes/, images insrc/site/img/user/. - Every push to
masterruns the GitHub Actions workflowdeploy.yml, which builds the site with Eleventy and deploys it to GitHub Pages. The site is live about a minute later.
Publish content from Obsidian only. Don't edit src/site/notes/ in the repo by hand; the plugin owns it.
Publishing a note
- Add
dg-publish: trueto the note's properties (or run Digital Garden: Add publish flag). - Run Digital Garden: Open Publication Center.
- Check the lists of new, changed and deleted notes, then click Publish.
To take a note down, set dg-publish: false (or remove it) and publish again. The note shows up under deleted notes.
Note properties
| Property | Effect |
|---|---|
dg-publish: true |
Publish the note |
dg-home: true |
Make it the home page (only one note). Currently this note |
dg-hide-in-filetree: true |
Keep the page, but hide it from the sidebar |
dg-hide: true |
Hide from the sidebar and the graph |
dg-hide-in-graph: true |
Hide from the graph only |
dg-pinned: true |
Pin to the top of its folder in the sidebar |
dg-permalink: my-url |
Custom URL instead of the folder path |
dg-path: Folder/Name |
Show the note at a different path in the site |
title: ... |
Title shown on the page and in the sidebar |
URLs come from the vault path, lowercased with dashes: 21. Application/Cube/PLL/PLL T.md becomes /21-application/cube/pll/pll-t/. Moving or renaming a note changes its URL.
What gets converted
- Links
[[Note]]become links to the published note. Links to unpublished notes are shown as dead links. - Images
!150sets the width. - Dataview:
```dataviewblocks are turned into static tables at publish time, using the vault's current data. Re-publish to refresh them.```dataview_(with the underscore) is not a query, so it is published as a raw code block. That's why OLL and PLL in Cube show the query text.
- Math
$...$and$$...$$work.
Canvas
A canvas has no properties panel, so the flag goes inside the .canvas file (edit it as text, e.g. in VS Code):
"metadata": {
"frontmatter": {
"dg-publish": true
}
}
Put it next to "nodes" and "edges", then publish from the Publication Center. The page is zoomable and its URL ends in .canvas/.
Look and settings
- Site name, theme (currently AnuPpuccin) and light/dark mode are set in the plugin settings under Appearance. Saving them commits an "Update settings" change to the repo.
- Extra CSS goes in
src/site/styles/custom-style.scssin the repo (code change, via a PR). - The sidebar always shows a folder, even when every note in it is hidden. Hiding the empty folders themselves would need a CSS change in the repo.
Repo notes
static/holds files copied into the site as-is:sw.jsclears the old Jekyll blog's offline cache for returning visitors.2022/05/04/...,2025/01/01/...,2026/02/14/...redirect old blog post URLs to the new pages.
scripts/publish-local.jsimitates the plugin for local previews (not for publishing).- Local preview:
npm run publish:local -- ../../obsidian "21. Application/Cube" "05. Write" NODE_USE_SYSTEM_CA=1 npm run site:build npm run serve:dist # http://localhost:8080NODE_USE_SYSTEM_CA=1is needed on the work laptop, because the company network replaces GitHub's TLS certificate.
Links
- Docs: https://docs.forestry.md
- Template: https://github.com/oleeskild/digitalgarden