From b2394723c50699218929165f8a568caf1ffc6192 Mon Sep 17 00:00:00 2001 From: uint Date: Sat, 20 Dec 2025 10:49:38 +0000 Subject: fix directories with only index.md being skipped --- kew.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kew.go b/kew.go index 208136d..c6a5fd6 100644 --- a/kew.go +++ b/kew.go @@ -31,11 +31,6 @@ func build_nav(dir string, root string) (NavNode, bool) { if e.IsDir() { child, ok := build_nav(full, root) if ok { - _, err := os.Stat(filepath.Join(full, "index.md")) - if err == nil { - rel_dir, _ := filepath.Rel(root, full) - child.Path = rel_dir + "/index.html" - } node.Children = append(node.Children, child) } continue @@ -43,6 +38,12 @@ func build_nav(dir string, root string) (NavNode, bool) { if strings.HasSuffix(e.Name(), ".md") { if e.Name() == "index.md" { + rel_dir, _ := filepath.Rel(root, dir) + if rel_dir == "." { + node.Path = "index.html" + } else { + node.Path = rel_dir + "/index.html" + } continue } rel, _ := filepath.Rel(root, full) @@ -55,7 +56,7 @@ func build_nav(dir string, root string) (NavNode, bool) { } } - if len(node.Files) == 0 && len(node.Children) == 0 { + if len(node.Files) == 0 && len(node.Children) == 0 && node.Path == "" { return node, false } -- cgit v1.2.3