From 5f835a8a4e0c7b5395fa28f1d2559f59741e9f4c Mon Sep 17 00:00:00 2001 From: luxick Date: Fri, 24 Jul 2026 11:26:23 +0200 Subject: [PATCH] Omit Files section when no files are present --- render.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/render.go b/render.go index a592df7..19eb11f 100644 --- a/render.go +++ b/render.go @@ -232,6 +232,13 @@ func listEntries(fsPath, urlPath, sortKey, order string) []entry { sortEntries(folders, sortName, order) sortEntries(files, sortKey, order) + // Nothing to list (only index.md, which is rendered above): return no + // entries so the Files section is suppressed entirely rather than showing + // an empty listing with just the `..` row. + if len(folders) == 0 && len(files) == 0 { + return nil + } + // `..` row mirrors the header Up button so the listing itself is // navigable without reaching for the header on mobile. Prepended after // sort so it always sits at the top regardless of folder names.