Files
org_web/build-site.el
2026-07-08 22:09:29 +01:00

64 lines
1.6 KiB
EmacsLisp
Executable File

;;; build-site.el --- Publish my website using org-publish -*- lexical-binding: t; -*-
;; Run with:
;; emacs -Q --script build-site.el
;;
;; Optional env vars:
;; SITE_FORCE=1 Force republish all files (default: incremental)
;; SITE_DRY=1 Parse and prepare only; skip org-publish-all
;; SITE_CLEAN=1 Wipe output/ and .org-timestamps/ before publishing
;;; Code:
(defconst z/build-start-time (float-time)
"Wall-clock time when the build started.")
(defconst z/site-root
(file-name-as-directory
(file-name-directory
(or load-file-name buffer-file-name)))
"Absolute path to the site root.")
(defvaralias 'site-root 'z/site-root)
(setq create-lockfiles nil)
(defun site-path (path)
"Expand PATH relative to `z/site-root'."
(expand-file-name path z/site-root))
(defconst z/output-root
(file-name-as-directory
(expand-file-name
(or (getenv "SITE_OUTPUT_DIR")
(site-path "output/"))))
"Absolute path to the site output directory.")
(defun output-path (path)
"Expand PATH relative to `z/output-root'."
(expand-file-name path z/output-root))
(add-to-list 'load-path (site-path "lisp"))
(require 'build-core)
(z/bootstrap-packages)
(z/configure-org)
(dolist (library '(recently-updated
tags
sidenotes
sitemaps
build-assets
build-comments
build-html
build-lima
build-projects
build-runner))
(z/require-local library))
(z/configure-publish-projects)
(z/run-build)
;;; build-site.el ends here