hosting org ssg somewhere

Table of Contents

1. have an elisp script

1.1. using ox-publish

(package-initialize)

(require 'font-lock)
(require 'cl-seq)

(require 'org)
(require 'ox)
(require 'ox-html)
(require 'ox-publish)

(setq org-html-postamble nil)
(setq org-export-with-timestamps nil)
(setq org-export-time-stamp-file nil)

(setq org-publish-project-alist
      '(("org-files"
         :base-directory "."
         :base-extension "org"
         :publishing-directory "."
         :recursive t
         :publishing-function org-html-publish-to-html

         :with-toc nil
         :with-author nil
         :with-creator nil
         :with-date nil)))

(org-publish "org-files" t)
  • This will result in formatting of the src syntax highlighting peing all black with bold/italic/underline

1.2. older way to do it

(require 'org)
(require 'ox-html)

(dolist (file (directory-files-recursively "." "\\.org$"))
(with-current-buffer (find-file-noselect file)
  (org-html-export-to-html)
  (kill-buffer)))
  • this older way to do it requires to prepend it with https://emacs.stackexchange.com/questions/38437/org-mode-batch-export-missing-syntax-highlighting/79635#79635 to enable syntax highlighting and fix warnings
    • The result is color face src syntax highlighting
  • (setq org-html-head-include-default-style nil) to not include default styling. Per-file: #+OPTIONS: html-style:nil
  • (setq org-html-extension "htm")
  • (setq org-html-postamble nil) to not show Creation date and HTML validation link
  • (setq org-export-with-timestamps nil) or (setq org-export-time-stamp-file nil) not sure check docs
  • Hyperlinks will convert automatically from org to html.

2. declarative config

A netlify.toml would look like

[build]
command = "emacs --batch -Q -l build.el"
publish = "."

but you might want to add (message "Should work') to see if it's being ran. That is because Netlify Preview Servers execute a "[dev]" server instead. You need old style branch deploys to get the regular runner.

Anyway Netlify nowadays is offering only a credit-based Free tier where they shut down your website after too many builds or utilization. They introduced it with the AI features.

3. https://pgs.sh (https://pico.sh)

rsync --delete -rv --exclude='*~' ./* pgs.sh:/wiki1

3.1. TODO use git ls-files with s/\.org/\.html/ to generate rsync file list

doing hoops and loops not to use a publish/ directory