(require 'ox-publish)
;; 1. Define the project paths relative to this script
(setq project-root (file-name-directory (or load-file-name buffer-file-name)))
(setq org-notes-dir (expand-file-name "docs/" project-root))
(setq public-dir (expand-file-name "public/" project-root))
;; 2. Set up the publishing configuration
(setq org-publish-project-alist
`(("project-docs"
:base-directory ,org-notes-dir
:base-extension "org"
:publishing-directory ,public-dir
:recursive t
:publishing-function org-html-publish-to-html
:headline-levels 4
:auto-preamble t
;; This ensures ReadTheOrg works correctly
:html-head "
"
:html-head-extra "")
("project-static"
:base-directory ,org-notes-dir
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf"
:publishing-directory ,public-dir
:recursive t
:publishing-function org-publish-attachment)
("all" :components ("project-docs" "project-static"))))
;; 3. The magic command to build everything
(org-publish-all t)
(message "Build complete!")