Astro Publish

Configuration

#guide#setup

Almost everything is configured in one file: src/config/site.ts. It's the only file inside src/ you're meant to edit, and the update procedure deliberately never overwrites it.

By default each level sorts folders A→Z, then notes — newest-first when every note at that level has a date, alphabetically otherwise. That suits a reference vault, but not a guide, where Installation should come before Configuration. Two ways to override it:

List slugs in the order you want. Anything listed is pinned to the front of its level; everything else keeps the default order behind it.

export const siteConfig = {
  navOrder: [
    'docs',              // this folder first
    'notes',             // then this one
    'docs/installation', // and inside docs/, this page leads
  ],
};

Entries are vault-relative slugs, not display titles — 'projects' for content/projects/, 'notes/wikilinks' for a single note. Case and stray slashes don't matter. Three behaviors worth knowing:

  • Any level works. Nested paths order nested folders, not just the top level.
  • Pinning beats grouping. A pinned note sits above folders, overriding the usual folders-first arrangement.
  • Unknown slugs are ignored. Safe to leave entries for sections you haven't written yet.

order: — set it in frontmatter

For per-note control without touching config, add a number to the note's frontmatter:

---
title: Installation
order: 1
---

Notes sort ascending by that number, after anything pinned in navOrder and ahead of everything default-sorted. Folders have no frontmatter of their own, so a folder takes the order: of its collapsed index note.

[!tip] Which one? navOrder describes the shape of the whole site in one place. order: keeps a section's sequence with its content, so adding a page doesn't mean editing config. They compose — this vault uses navOrder for the top level and order: inside docs/.

Both apply to folder index pages too, so a folder's listing matches the nav.

Folder-collapse filenames

collapsedFolderFilenames: ['index', 'welcome'] as const,

A file with one of these names becomes its folder's page: content/projects/index.md is served at /projects, not /projects/index, and the folder name in the nav turns into a link. Add 'readme' if that's your convention.

Meta-bar fields

The strip between a note's H1 and its tag pills. Each entry reads one frontmatter key:

metaFields: [
  { label: 'Date', key: 'date' },
  { label: 'Author', key: 'author' },
  { label: 'Status', key: 'status', format: (v) => String(v ?? '').toUpperCase() },
  { label: 'Read time', key: 'readMinutes', format: (v) => typeof v === 'number' ? `${v} min` : undefined },
],

Fields render in order; a note missing the key is skipped. Return undefined from format to skip a value that doesn't apply.

Graph colors

The graph groups each note by its type frontmatter, falling back to the first folder segment of its slug, and looks that group up here:

graphColors: {
  default: 'var(--accent)',
  guide: '#60a5fa',
  project: '#34d399',
},

Values can be any CSS color or a var(--token) reference to a design token in src/styles/tokens.css.

Environment variables

Copy .env.schema to .env — it's gitignored, so it never ships with your notes.

Variable Purpose
SITE_URL Canonical URL used in the sitemap and meta tags
SITE_TITLE Site title in the header and <title>
SITE_DESCRIPTION Default <meta name="description">
OBSIDIAN_VAULT_DIR Vault path, if it isn't content/
ACCENT_HUE Theme accent hue, 0–360 (Obsidian Publish's default is 258)

Set the same variables in your host's build settings for production — they aren't read from .env there.

Branding

Replace public/favicon.svg and public/og-image.png with your own. astro.config.ts holds the site: fallback used for canonical URLs when SITE_URL is unset.

esc
Start typing to search…