Leaf Index
Leaf Index

Your first file index.

Start with a small directory of files you are comfortable listing.

1. Get the script

Download the readable Python file and keep the accompanying MIT license. No package installation or account is required.

Check Python from a terminal:

terminal
python3 --version

This release targets Python 3.9 or later. The commands below use macOS/Linux shell syntax; Windows users can use py -3 in place of python3 if that is their Python launcher.

2. Choose a directory

For example, a folder named notes containing a few text files:

example directory
notes/
  packing.txt
  reading.txt

3. Generate a new page

terminal
python3 leafindex.py ./notes --output ./notes/index.html --title "Reading notes"

The output filename must not already exist. If it does, choose a different name. The tool does not overwrite your existing pages.

4. Open and check

Open notes/index.html in a browser. Follow each link to confirm it points to the intended file. You can compare the result with the included sample.

To test through a local web server, run:

terminal
python3 -m http.server 8000 --bind 127.0.0.1 --directory ./notes

Open http://127.0.0.1:8000/. Stop the preview with Ctrl+C. This preview is bound to your own computer.

Before putting the folder on a public website, review every included file. Skipping dotfiles is a convenience, not a complete check for private material.