# Web Engine

A website generated from one file per page.

Each page has its own table of content (new since 2023-02-28).

# 1 Page Format

File has 4-line header, followed by 1 blank line, followed by content.

Header:

  1. title

  2. date --iso=s

  3. keywords (space separated)

  4. description

Content is djot markup, https://djot.net.

# 2 Indices

Indices sorted by date are generated for each keyword, and everything.

For index foo, pages/_foo.djot is included at the start.

The main index lists recent changes from everything, and lists keyword indices.

index/*.ix is used temporarily.

Each index has a corresponding RSS feed.

# 3 Bugs

  • Removing a keyword from a page will not update the corresponding index file, you must do that on your own.

  • Removing an index file will lead to inconsistency.

  • Removing or renaming a page will lead to inconsistency.

  • Modifying the script rebuilds everything (this is intentional).

  • The index processing is quadratic time in the number of pages.

  • A page named the same as an index (keyword) will be overwritten.

# 4 Source

# 5 Dependencies

  • sudo apt install lua5.4

  • git clone -b mathr https://code.mathr.co.uk/djot.lua.git

    Note: this changed 2023-02-27 (forked from original github repository)

    Note: this changed 2023-01-02 (split from original djot.git repository).

# 6 Deployment

Automatic build on git push via server’s web.git/hooks/post-receive:

#!/bin/sh
TARGET="/path/to/work/web"
GIT_DIR="/path/to/bare/web.git"
BRANCH="main"

while read oldrev newrev ref
do
  if [ "X${ref}" = "Xrefs/heads/${BRANCH}" ]
  then
    echo "Deploying ${ref}..."
    git --work-tree="${TARGET}" --git-dir="${GIT_DIR}" checkout -f
    ( cd "${TARGET}" && ./build.sh )
  fi
done