Hugo, deploy tools and site scaffolds for publishing static sites from Emacs
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-19 13:54:27 -04:00
defaults Fix known_hosts in check mode and with HashKnownHosts; drop brew git 2026-10-18 21:30:10 -04:00
files Install brain2's fixed pages: search.md and notes/_index.md 2026-10-19 13:53:16 -04:00
meta Quote min_ansible_version for the meta schema 2026-10-18 21:31:06 -04:00
tasks Create static/: ox-hugo refuses to export without it 2026-10-19 13:54:27 -04:00
templates Initial hugo-publish role: Hugo, deploy tools and brain2 scaffold 2026-10-18 21:25:57 -04:00
.gitignore Initial hugo-publish role: Hugo, deploy tools and brain2 scaffold 2026-10-18 21:25:57 -04:00
README.md Install brain2's fixed pages: search.md and notes/_index.md 2026-10-19 13:53:16 -04:00

hugo-publish

Sets up a machine to build Hugo sites and publish them, so that M-x brain2-publish works there: installs Hugo and rsync via Homebrew, and scaffolds each site directory (hugo.toml, archetype, .gitignore, deploy.sh, theme). The serving side is the static-sites role on razorback.

What it does not install: Emacs, ox-hugo and the brain2-* commands come from the dotfiles (emacs/*/init.org), and the Org source is the ~/orgfiles repo.

Requirements

  • Homebrew installed (Linuxbrew on Linux).
  • community.general collection.
  • For publishing: this machine's ssh key authorized on each site's deploy_host (ssh-copy-id razorback.local, once per machine). The role trusts the host key and warns, without failing, when the login is refused.

Role Variables

Variable Default Description
brew_bin_dir /home/linuxbrew/.linuxbrew/bin (Linux), /opt/homebrew/bin (macOS) Homebrew bin directory; also put first on deploy.sh's PATH.
hugo_publish_packages [hugo, rsync] Homebrew formulae installed.
hugo_publish_sites_dir ~/sites Parent of the site directories.
hugo_publish_sites brain2 Sites: {name, config, base_url, deploy_host, deploy_dest, theme, theme_repo, theme_version}; config is a template under templates/sites/.

Example Playbook

- hosts: anubis
  roles:
    - role: hugo-publish

Notes

  • content/ is ox-hugo output and public/ is Hugo output; neither is managed, except for the fixed pages under files/sites/<name>/ (brain2's search page and notes/_index.md), which are copied in. Everything else in the site directory is overwritten on each run, so change hugo.toml here (templates/sites/), not in place.
  • The theme is cloned once (update: no); an existing checkout or git submodule is left at its commit.
  • deploy.sh rsyncs with --delete, so the last publish wins. Pull ~/orgfiles before publishing from another machine.
  • deploy.sh honours <NAME>_HOST, <NAME>_DEST and <NAME>_BASE_URL (e.g. BRAIN2_HOST) to override the site entry.