Wikidown

Home / Getting Started / Publishing to GitHub Pages

Publishing to GitHub Pages

A Wikidown wiki publishes to GitHub Pages through a GitHub Actions workflow: on every push, the workflow runs wikidown export-html to render the wiki to a static site and deploys it. wikidown pages writes that workflow for you. That's how wikidown.org itself is published: it is this wiki, exported on every change.

Upgrading from 0.13 or earlier? Wikidown no longer supports GitHub's built-in Jekyll builder ("Deploy from a branch"). See Migrating from Jekyll Publishing.

Quick start

From the repo root (--root docs is the default):

wikidown pages
git add .github docs
git commit -m "Publish the wiki to GitHub Pages"
git push

Then in GitHub: Settings → Pages → Source: "GitHub Actions". The workflow runs on the push (watch it under the Actions tab), and the wiki is live at https://<owner>.github.io/<repo>/ when it finishes.

Options:

What it writes

File Purpose
.github/workflows/pages.yml Written at the root of the git checkout. Calls Wikidown's reusable workflow with root: set to the wiki folder.
_config.yml (wiki root) Site settings: title, description, repository_url (GitHub link in the top bar), favicon, url and image (link previews), and wikidown.exclude_from_site (below).

With --theme, it also copies the starter theme into the wiki root:

File Purpose
_layouts/wikidown.html, _includes/nav-tree.html Top bar, collapsible left nav built from .order (active page highlighted, ancestors expanded), content column, footer. On narrow screens the nav becomes a slide-in drawer.
assets/wikidown.css Styling, same palette as wikidown.org.
index.html Redirects the site root to /Home.html (or the first top-level page if there is no Home). Replace it with a landing page if you want one.

Without --theme, the CLI's built-in copy of the theme is used, so the site picks up theme fixes when the workflow installs a newer CLI. Copy the theme only when you want to change it; see Customizing the Theme and, for landing pages and data-driven layouts, Site Templates.

The workflow

wikidown pages writes this file. You can also write it by hand:

name: pages
on:
  push:
    branches: [main]
  workflow_dispatch:
permissions:
  contents: read
  pages: write
  id-token: write
concurrency:
  group: pages
  cancel-in-progress: false
jobs:
  pages:
    uses: markdav-is/Wikidown/.github/workflows/wiki-pages.yml@main
    with:
      root: docs              # the wiki folder, relative to the repo root
      # base-url: /my-repo    # only to override the detected path
      # cli-version: 0.14.0   # pin a Wikidown.Cli version; default is the latest

The reusable workflow installs the Wikidown.Cli tool, runs wikidown export-html --clean, and deploys the result. The job fails if the export fails, for example on a template error.

Excluding pages from the published site

Internal notes can stay in the wiki without shipping to the site. List subtrees under wikidown.exclude_from_site in _config.yml:

wikidown:
  exclude_from_site:
    - /Meta
    - /Testing

Excluded pages remain first-class for the CLI, editor, and check-links. They just produce no .html and no nav entry.

Body links pointing into an excluded subtree will 404 on the published site. check-links still validates them against the repo (where the pages exist), so trim such links from published pages yourself.

How the wiki maps to the site

Previewing locally

wikidown export-html --output _site --clean
dotnet serve -d _site      # dotnet tool install -g dotnet-serve

Or npx serve _site. Add _site to .gitignore. The export uses the same theme, settings, and renderer as the workflow, so what you see is what deploys.

export-html options:

Other hosts

export-html output is a plain static folder, so any CI can publish it: Publishing to GitLab Pages covers GitLab, and the same command works for Azure Static Web Apps, Netlify, or a file share.

See CLI for the full command list, Format for the on-disk conventions, and Site Templates for changing how the site looks.