2 min read
pyssg.presets.obsidian
obsidian preset: publish an Obsidian vault as a site.
A pure factory that returns a :class:~pyssg.Config wired for an Obsidian vault:
the PKM Markdown pipeline (wikilinks, embeds, tags), vault-noise excludes,
attachment handling and selective publishing, plus a default theme. The basic
user writes a one-line pyssg.config.py::
from pyssg.presets import obsidian
config = obsidian(site={"title": "My Garden"})
Unlike :func:pyssg.presets.docs / :func:pyssg.presets.blog, the Obsidian
support lives in :mod:pyssg.contrib.obsidian (a peripheral adapter); this preset
only composes that pipeline with a theme, so it still merely declares facts.
Publishing is a denylist by default (publish_required=False): every note
is rendered unless its frontmatter sets publish: false, which suits a
whole-vault wiki. Pass publish_required=True for an allowlist, where a note is
rendered only when it sets publish: true.
Hugo-style _index.md section pages are routed to their directory root by
default (section_index=True), so a migrated vault gets section landing pages
without explicit permalinks.
Vault layout note: when the vault root itself is the content directory
(content_dir="."), add the output directory to exclude (e.g.
exclude=["dist"]) so the build does not re-ingest its own output.
obsidian(*, site: dict[str, object] | None = None, base_url: str = '', content_dir: str = 'content', output_dir: str = 'dist', layout: str | Path | None = None, include: Sequence[str] | None = None, exclude: Sequence[str] | None = None, publish_required: bool = False, publish_key: str = 'publish', section_index: bool = True, highlight_style: str = 'default', rss_title: str | None = None, extra_plugins: Iterable[Plugin] | None = None) -> Config
Build a :class:Config for an Obsidian vault.
layout defaults to the built-in docs theme. include / exclude
are content-relative glob filters (the vault-noise defaults from
:data:~pyssg.contrib.obsidian.DEFAULT_VAULT_EXCLUDE are always applied on top
of exclude). publish_required toggles allowlist vs denylist publishing
(default denylist). section_index routes _index.md to its directory
root. extra_plugins are appended after the defaults. rss_title defaults
to the site title.