vault_to_site
Convert an Obsidian vault into a static html site. Uses handlebars templates which can be specified on a per-file basis.
vault_to_site
Convert an Obsidian vault into a static html site.
I searched for a tool to do this simple conversion and could not find it. This is ~200 lines of rust code that does everything I need. I did not want to incorporate JS or Github Actions into my workflow for the simple task of creating a website from markdown files.
Usage:
vault_to_site --vault <VAULT> --output <OUTPUT_DIR> --templates <TEMPLATES> --title <YOUR_NAME>
(You will need to compile first with Cargo)
Templates
The Markdown files are rendered to html using Handlebars templates.
templates can either be a folder of handlebars templates, or a single template to render all files with. If a folder, default.hbs in that folder will be used unless a markdown file has a title attribute at the front. You can, for example have a file called article.hbs in your templates folder, then in the first lines of a markdown file specify:
---
template: article
---
And that markdown file will render using article.hbs in your templates folder.
When rendering, each template will have access to the {{{title}}} and {{{content}}} fields of the note. So the minimal template looks like this:
<!DOCTYPE html>
<html>
<head> <title>{{title}}</title> </head>
<body> {{{content}}} </body>
</html>
Other than that, you can freely create html surrounding the content of each note -- a header, navigation links, etc.
Linking
Files can link to each other as normal in obsidian using [[note_name]] syntax, or [[note_name|Display Text]]. Ordinary markdown links work as expected using [Display Text](url) syntax.
How to Install
- Download the ZIP or clone the repository
- Open the folder as a vault in Obsidian (File → Open Vault)
- Obsidian will prompt you to install required plugins
Stats
Stars
0
Forks
0
Last updated 1d ago