Skip to content

Process Obsidian notes to publish them with Hugo. Supports transformation of Obsidian wiki links into Hugo shortcodes for internal linking.

License

Notifications You must be signed in to change notification settings

bopo/obsidian-to-hugo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Obsidian Vault to Hugo Content

A simple CLI written in Python to help us publish obsidian notes with hugo.

It only takes two arguments: The obsidian vault directory (--obsidian-vault-dir) and the hugo content directory (--hugo-content-dir).

python path/to/obsidian-to-hugo/src --obsidian-vault-dir=<path> --hugo-content-dir=<path>

The program will take care of the following steps:

  1. Clears hugo content directory (directory will be deleted and recreated)

  2. Copies obsidian vault contents into hugo content directory (.obsidian gets removed immediately after copying)

  3. Replaces obsidian wiki links ([[wikilink]]) with hugo links ([wikilink]({{< ref "wikilink" >}}))

Replacement examples

Obsidian Hugo

obsidian

hugo

[[/some/wiki/link]]

[/some/wiki/link]({{< ref "/some/wiki/link" >}})

[[/some/wiki/link|Some text]]`

[Some text]({{< ref "/some/wiki/link" >}})

[[/some/wiki/link/_index]]

[/some/wiki/link/]({{< ref "/some/wiki/link/" >}})

ℹ️
For now, there is no way to escape obsidian wiki links. Every link will be replaced with a hugo link. The only way to get around this is changing the wiki link to don’t match the exact sytax, for example by adding an invisible space >​< (Obsidian will highlight the invisible character as red dot).
do not do that
However, this still is really really not best practice, so if anyone wants to implement real escaping, please do so.

Usage

usage: path/to/obsidian-to-hugo/src [-h] [--hugo-content-dir HUGO_CONTENT_DIR] [--obsidian-vault-dir OBSIDIAN_VAULT_DIR]

optional arguments:
  -h, --help            show this help message and exit
  --hugo-content-dir HUGO_CONTENT_DIR
                        Directory of your Hugo content directory, the obsidian notes should be processed into.
  --obsidian-vault-dir OBSIDIAN_VAULT_DIR
                        Directory of the Obsidian vault, the notes should be processed from.

About

Process Obsidian notes to publish them with Hugo. Supports transformation of Obsidian wiki links into Hugo shortcodes for internal linking.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%