Configuration
Dendron lets you control publication behavior at three levels:
- globally through
dendron.yml
configuration - per note through the publication related frontmatter
- per line through custom dendron directives inside the note
Global Configuration
The dendron.yml
configuration file controls what notes get published. It is located at the root of your workspace.
.
โโโ {workspace}
โโโ dendron.yml
Below is the config that is used to publish dendron.so
from the contents of this repo
site:
siteHierarchies: [dendron]
siteRootDir: docs
Properties
assetsPrefix?:
Prefix for assets.
- NOTE: By default, assets are served from the root. If you are publishing to github pages and followed the instructions here by creating a repo named
{username}.github.io
, then no further action is needed. This is because github will make your site available athttps://{username}.github.io
. If you created a custom repo, you will need to set the prefix to the name of your repo because github will make your site available athttps://username.github.io/{your-repo-name/}
copyAssets
- required: no
- type: boolean
- default: true
Copy assets from vault to site.
siteHierarchies: str[]
List of hierarchies to publish
siteIndex?: str
- optional, path of your index (home page)
- defaults to the first element of
siteHierarchies
siteRootDir
Location of the directory where site will be build. Relative to your workspace
siteRepoDir
- required: no
- type: string
Location of the github repo where your site notes are located. By default, this is assumed to be your workspaceRoot
if not set. This is used with the Publish Notes
command
usePrettyRefs
- default: True
Whether to use pretty note refs or plain refs.
config
Per hierarchy specific config. To set options for all hierarchies, set {hiearchy name}
to root.
config:
{hierarchy name}: {hierarchy options}
The list of possible options:
- publishByDefault: boolean, default: true
- if set to false, dendron will only publish notes within the hierarchy that have
published: true
set in the frontmatter
- if set to false, dendron will only publish notes within the hierarchy that have
- noindexByDefault: boolean, default: false
- if set to true, dendron will add the following meta tag
<meta name="robots" content="noindex, nofollowโ>
which will tell google to not index your page - when google indexes a page, it will penalize sites that have duplicate content from other sites. this is useful if you are using your hiearchy as a cache
- if set to true, dendron will add the following meta tag
- customFrontmatter: list, default: []
- if set, dendron will add the specified frontmatter to each published note in the hierarchy. note that this will override existing keys with the same name when publishing
- eg. add
toc: true
to all notes published under theiam.*
hierarchy
config: iam: customFrontmatter: [ { key: "toc", value: true, } ]
Examples
Blog
Below is the config for kevinslin.com. It publishes everything under the home
and blog
hierarchies but will only publish notes under books
if published: true
is set on the frontmatter.
- dendron.yml
site:
siteHierarchies: [home, blog, books]
siteRootDir: docs
config:
books:
publishByDefault: false
Example publishing entire vault
- vault
.
โโโ root.md
โโโ dendron.md
โโโ dendron.quickstart.md
โโโ dendron.zen.md
โโโ flowers.md
โโโ flowers.bud.md
- dendron.yml
publish:
siteHierarchies: [root]
- what gets published
.
โโโ root.md
โโโ dendron
โ โโโ dendron.quickstart
โ โโโ dendron.zen
โโโ flowers
โโโ flowers.bud
Example publishing just one domain
- vault
.
โโโ root.md
โโโ dendron.md
โโโ dendron.quickstart.md
โโโ dendron.zen.md
- dendron.yml
publish:
siteHierarchies: [dendron]
- published:
.
โโโ dendron
โโโ dendron.quickstart
โโโ dendron.zen
Vault Configuration
The following needs to be set in the vaults section of the config.
Configuration
visibility?
- choices: "private|public"
If set to private, notes in this vault will not be published regardless of any other configuration. This takes precedences over everything.
Backlinks
Note Configuration
You can specify how notes are published via the frontmatter of each note.
Properties
published
- type: boolean
- default: true
To exclude a page from publication, you can add the following to the frontmatter. If you set publishByDefault: false
for a hierarchy, this needs to be set to true
to publish
...
published: false
noindex
- type: boolean
- default: true
To tell google to not index a page, you can add the following tag to the frontmatter. You can also have this as a default for a given hierarchy by setting noIndexByDefault: true
in the site config.
...
noindex: true
toc
- type: boolean
- default: false
To generate a table of contents in a given note, enable this directive in the note frontmatter.
toc: true
You will also need to include the following line somewhere in the note body. Dendron will generate a table of contents when it finds that particular header
## Table of Contents
The output will look like the below.
- NOTE: in order to generate a table of contents, the heading levels after ToC need to be at an equal level or greater than the heading level of
Table of Contents
- this is okay
## Table of Contents ## Header1 ## Header2
- this is not
## Table of Contents ### Header1 ### Header2
Line Configuration
You can control publication on a per line basis.
Properties
LOCAL_ONLY_LINE
`
Hello World! <!-- Will be published -->
<!-- won't be published -->