Do not render parent of root directory

This commit is contained in:
Pim van Pelt
2025-12-03 12:16:54 +01:00
parent 11fbbd4b42
commit 7829000c55
2 changed files with 9 additions and 0 deletions

View File

@@ -214,11 +214,13 @@ func ProcessDir(topDir string, opts *Options) error {
Entries []FileEntry
DirAppend bool
OutputFile string
IsRoot bool
}{
DirName: dirName,
Entries: entries,
DirAppend: opts.DirAppend,
OutputFile: opts.OutputFile,
IsRoot: false, // Local filesystem always shows parent directory
}
if opts.DryRun {
@@ -957,6 +959,7 @@ const htmlTemplateString = `<!DOCTYPE html>
</tr>
</thead>
<tbody>
{{if not .IsRoot}}
<tr class="clickable">
<td></td>
<td><a href="../{{if .DirAppend}}{{.OutputFile}}{{end}}">
@@ -969,6 +972,7 @@ const htmlTemplateString = `<!DOCTYPE html>
<td class="hideable">&mdash;</td>
<td class="hideable"></td>
</tr>
{{end}}
{{range .Entries}}
<tr class="file">
<td></td>