This is a simple python script that converts Obsidian notes to a format that is compatible with Jekyll themes that support wikilinks and backlinking like Jekyll Garden or Digital Garden Jekyll Template. It adds the filename to the frontmatter as a title and lets you set the visibility of your notes on a folder or note-by-note basis.
To convert your vault into theme-compatible markdown, run
python3 [OBSIDIAN_VAULT_DIR] [OUTPUT_DIR]
Notes are either public or private, where the script does not copy over notes that are defined as private.
public: yes
or public: no
in the yaml frontmatter..public
or a .private
file in the directory.This script is part of my selfmade Obsidian publish setup, which is roughly outlined below. It uses the Jekyll Garden theme and Github Pages to publish the notes.
The setup consists of 3 separate repositories:
ducttape-obsidian-publish
├── obsidian-to-jekyll
├── jekyll-directory
└── obsidian-vault
The following Github workflow is placed in the obsidian-vault repository and opdates the Jekyll page whenever there is a change to the vault. Add ssh credentials and adjust the filepaths if you intend to use the workflow in your own setup.
name: Publish Notes to Jekyll
on:
push:
branches:
- master
workflow_dispatch:
jobs:
deploy-application:
runs-on: ubuntu-latest
steps:
- run: |
eval $(ssh-agent -s)
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "${{ secrets.DEPLOYMENT_SERVER_KEY }}" | tr -d '\r' | ssh-add -
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
ssh ${{ secrets.DEPLOYMENT_SERVER_USER }}@${{ secrets.DEPLOYMENT_SERVER_IP }} "cd /YOURPATH/ducttape-obsidian-publish/obsidian-vault && git pull"
ssh ${{ secrets.DEPLOYMENT_SERVER_USER }}@${{ secrets.DEPLOYMENT_SERVER_IP }} "cd /YOURPATH/ducttape-obsidian-publish/obsidian-to-jekyll && python3 ./convert.py ../obsidian-vault ../jekyll-directory/NOTE_DIRECTORY"
ssh ${{ secrets.DEPLOYMENT_SERVER_USER }}@${{ secrets.DEPLOYMENT_SERVER_IP }} 'cd /YOURPATH/ducttape-obsidian-publish/jekyll-directory && git pull && git add . && git commit -m "Update Digital Garden" && git push'