dendron-hugo-pod
v1.0.8
Published
A Dendron pod for exporting Markdown to Hugo.
Downloads
8
Readme
Features
- This pod is the same as the built-in HTML pod, except:
- It preserves frontmatter!!!mostly
- It processes the file structure and all links into what Hugo likes
- Backlinks, children, and original filename are included as arrays in the frontmatter (so you have greater control via shortcodes)
- A new
enableFMTitle
frontmatter tag enables/disables title rendering (which is nice for custom titles)
Installation
- Set up NodeJS in your Dendron workspace.
- Set up Hugo in your Dendron workspace. With a theme. hugo-book is a good choice.
npm i @dendronhq/dendron-cli
npm i dendron-hugo-pod
npx dendron exportPod --podId hugo --podPkg dendron-hugo-pod --podSource custom --config dest=content,assets=static
hugo server
orhugo
Some hugo config:
markup:
goldmark:
renderer:
unsafe: true # render html in md files
markup:
tableOfContents: # render more than h1-h3 in toc
startLevel: 2
endLevel: 6
staticDir: notes # eliminate need to copy the assets folder - depends on your needs, though
taxonomies: # set hugo categories/tags page names to something you will never use so the dendron tag page will actually work
category: ebrbbrbrbrbrbrbrrbrbr
tag: ebrbbrbrbrbrbrbrrbrbr
disableKinds:
- "taxonomy"
- "term"
Some additional hugo config for hugo-books
, specifically
params:
BookTheme: auto # auto light/dark theme
BookPortableLinks: true # don't break when .md is used in links
BookSection: "*" # render all files in site map
Configuration Options
dest
- content directoryassets
- static assets directory- defaults to not copying assets at all
asset_prefix
- path section to prepend to images on sites where the site isn't actually at the root- defaults to using the asset prefix in dendron.yml
nav_exclude
- equivalent hugo frontmatter tag to dendron'snav_exclude
tagnav_order
- equivalent hugo frontmatter tag to dendron'snav_order
tagnav_collapse
- hugo frontmatter tag for allowing files to collapse in the sidebar (looking at you,hugo-books
)
Caveats
- Headings that aren't in the format "
### name
" are not guaranteed to work with tables of contents. - Don't put empty lines in mermaid blocks or Hugo doesn't render them.
- Schemas aren't supported.
- Note references/embeds need custom styling to look correct but are supported properly.
- Your asset prefix should be prefixed with a
/
so it looks globally instead of relative to the current page.
Project Status
Hopefully, this project is complete. It may change in the future if I come across something that needs adding or fixing.
License
This project is licensed under the GPLv3 license.
Large amounts of the code are based on Dendron's built-in pods.