Welcome to your Personal Knowledge Management Garden!
This project publishes selected notes from an Obsidian vault on GitHub Pages.
In May 2024 I started to use Obsidian as a note taking app.
I aimed to publish my notes on GitHub Pages to share them with others, starting with the Jekyll Garden Theme.
Having used Notion extensively, my notes were structured around the Personal Knowledge Management (PKM) system by Tiago Forte - building a second brain.
Migrating my Notion notes to Obsidian involved exporting them as HTML files due to issues with Markdown and CSV exports. Additionally, I had to use 7-Zip on Windows 11 to unzip the files properly.
In Obsidian, I utilize plugins like:
Importing HTML files into Obsidian posed issues with asset references, which I plan to address later (see Issue #10).
build-and-deploy-github-pages.yml
)Follow step by step:
Start with instructions to use this repository as a template.
IMPORTANT: Manage your personal access token on GitHub.
Clone your repository.
For example:
git clone https://github.com/<your-github-username>/<your-github-username>.github.io.git
cd <your-github-username>.github.io
IMPORTANT: Install Pre-commit Git Hook to enable the pre-commit hook.
IMPORTANT: Insert https://<your-github-username>.github.io
in URL field in _config.yml
.
(Optional) Configure title, description, and other settings in _config.yml
.
Prepare notes to be published.
(Optional) Test your site locally.
Publish notes on GitHub Pages.
Use this template
button located at the top of the repository page.Create a new repository
.Fill out the form:
Repository name: <your-github-username>.github.io
Replace
<your-github-username>
with your GitHub username.
Finish by clicking Create repository
.
Continue with Step 2 of Using the Repository As Template.
Navigate to Your GitHub Account:
Access Developer Settings:
Generate a New Token:
Tokens (classic)
.Configure the Token:
ACTIONS_PAT
.repo
(for full control of private repositories)workflow
(for updating GitHub Actions workflows)admin:org
(if deploying to organizational repositories)Copy the Token:
Copy the generated token.
:bell:You will not be able to see it again.
Navigate to Your Repository:
Access Repository Settings:
Add a New Secret:
ACTIONS_PAT
.Ensure the GitHub Actions workflow file build-and-deploy-github-pages.yml
references the secret you created.
If you used a different secret name, replace ACTIONS_PAT in the workflow file with the name of your secret.
For example, if your secret is named MY_SECRET_PAT, update the token field as follows:
with:
token: ${{ secrets.MY_SECRET_PAT }}
Continue with Step 3 of Using the Repository As Template.
:bell: Avoid having too long markdown file names and extensive folder hierarchies to prevent issues with the site generation.
:bell: Importing notes from another note taking app can be a time-consuming process to fulfill your requirements.
You should check the rules in .markdownlint.jsonc
before to adjust the linting rules to your needs.
Steps to add an Obsidian vault to be published:
_notes/Public
directory.Welcome
note in Obsidian.MAKE.md
in Obsidian.MAKE.md
in Obsidian.If you want to import notes from another note taking app:
Importer
in Obsidian.Importer
in Obsidian.Importer
plugin.Open Importer
and choose your File format
.
If needed Choose file
to import.
Leave Output folder
blank to output to vault root.
Optionally choose other settings.
Import
.Assets like pictures etc. are stored in the Public
directory by default. Linking of assets in the markdown files is not supported yet (see Issue #10).
Continue with Step 6 of Using the Repository As Template.
You can hide a note from the feed by changing the front matter of the note.
Here's how:
---
title: Note Title
feed: hide # before it was --- feed: show
---
Another way to hide notes from the feed is to move them to the _notes/Private
directory.
_notes
directory called Private
and move the notes you want to hide there.Add your changes to the repository with the Version Control System of your choice.
Commit your changes.
A Python script, executed by the pre-commit hook, will add front matter to the notes in the _notes/Public
directory and all its sub-directories.
After that it will lint the markdown files using markdownlint-cli2
.
If linting fails, the commit will be aborted.
You can fix the linting issues manually or by editing the .markdownlint.jsonc
file to adjust the linting rules to your needs.
After fixing commit again.
Continue with Step 7 of Using the Repository As Template.
:bell: Ensure you have both installed Ruby and Bundler.
Install dependencies:
bundle install
Run the site locally:
bundle exec jekyll serve
The site will be available at http://localhost:4000
.
:bell: Ensure you have installed Docker and docker is running.
Run Docker Compose:
docker-compose up -d
The site will be available at http://localhost:4000
.
Continue with Step 8 of Using the Repository As Template.
Push your changes to GitHub.
:bell: Ensure you have pushed your changes to the main
or develop
branch.
Your site will be published at https://<your-github-username>.github.io
.
To include the Obsidian Graph View in your site, follow these steps:
A pre-commit Git hook pre-commit.sample
ensures code quality and consistency before commits are made.
Copy the script pre-commit.sample
to your local .git/hooks
directory.
Rename it as pre-commit
.
Make sure it is executable.
For example:
cp pre-commit.sample .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit # may not be necessary
The hook performs the following tasks:
_notes/Public
directory and its sub-directories.markdownlint-cli2
.Continue with Step 4 of Using the Repository As Template.
A Python script is included to automate certain tasks, such as adding front matter to markdown files.
The script ensures that all markdown files in the _notes/Public
directory have the necessary front matter.
Necessary front matter includes the title
and feed
fields.
It is automatically executed by the pre-commit Git hook.
To use the script manually:
Run the script with the list of added or modified markdown files as arguments:
python add_front_matter.py _notes/Public/your_note.md _notes/Public/another_note.md
The script checks if the file already has front matter and adds it if necessary.
It also logs the process for each file.
This repository uses a GitHub Actions workflow to automate the build and deployment of the Jekyll site to GitHub Pages upon a push to the main
and develop
branch or by manual trigger.
The workflow consists of the following key steps:
GITHUB_TOKEN
to read contents, write pages, and generate ID tokens.Contributions are welcome! Follow these steps:
git checkout -b feature/YourFeature
).git commit -m 'Add some feature'
).git push origin feature/YourFeature
).This project is licensed under the MIT License. See the LICENSE file for details.