An elegant, searchable directory listing template for Jekyll and GitHub Pages.
It turns a content folder (default: public/) into an “Index of …” browsing experience with:
- file/folder listings
- breadcrumb navigation
- parent-directory navigation
- file-type icons
- in-page search and sorting
- Click Use this template.
- Create your new repository.
- Add your files under the content root (default:
public/). - Enable GitHub Pages in your new repository and choose GitHub Actions as the source.
- Push to
main.
The included workflow builds and deploys automatically.
node generate-directory-listings.jsscans your content root recursively.- It generates:
_data/directory.json(directory metadata)index.htmlfiles inside each content directory
- Jekyll renders pages using
_layouts/directory.html.
- Node.js 20+
- Jekyll toolchain for local preview (Ruby + Jekyll)
node generate-directory-listings.jsjekyll serveThen open http://localhost:4000.
Default content root is public.
You can change it in _config.yml:
content_root: publicOr override for generation with an environment variable:
CONTENT_ROOT=downloads node generate-directory-listings.jsWhen changing content_root, move your files/folders to that directory.
Symlink handling is intentionally conservative so that builds stay reproducible and safe:
- File symlinks inside the content root are listed (marked as symlinks) and served like normal files.
- Directory symlinks are listed, but never traversed — they link straight to their target's canonical listing page.
- Symlinks pointing outside the content root are skipped entirely (GitHub Pages would never publish their targets anyway).
- Broken symlinks and circular directory symlinks are reported as build breakers — remove or repair them, otherwise the Jekyll build fails with a filesystem error.
You can drop your own index.html into any content directory. The generator preserves user-authored pages and never overwrites them; generated pages are refreshed on every run. If your page uses layout: directory, its body content is rendered below the file table.
- Layout and styles:
_layouts/directory.html - File extension → icon mapping:
_includes/icon_mapper.html - Root redirect page:
index.html - Icons:
assets/icons/— all referenced icons (FatCow pack, CC BY 3.0) are committed to the repository, so a fresh clone builds and previews correctly without waiting for CI. The Fetch missing FatCow icons workflow keeps the set in sync automatically whenever the layout, mapper, or 404 page change.
MIT — see LICENSE.
Original repository author: Luka Mamukashvili.