Do not render parent of root directory
This commit is contained in:
@@ -269,17 +269,22 @@ func generateS3HTML(entries []indexgen.FileEntry, opts *indexgen.Options, client
|
|||||||
return fmt.Errorf("failed to get HTML template")
|
return fmt.Errorf("failed to get HTML template")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine if we're at root level (no parent directory)
|
||||||
|
isRoot := (indexKey == opts.OutputFile) // root level index.html
|
||||||
|
|
||||||
// Prepare template data (similar to ProcessDir in indexgen)
|
// Prepare template data (similar to ProcessDir in indexgen)
|
||||||
data := struct {
|
data := struct {
|
||||||
DirName string
|
DirName string
|
||||||
Entries []indexgen.FileEntry
|
Entries []indexgen.FileEntry
|
||||||
DirAppend bool
|
DirAppend bool
|
||||||
OutputFile string
|
OutputFile string
|
||||||
|
IsRoot bool
|
||||||
}{
|
}{
|
||||||
DirName: opts.TopDir, // Use bucket name as directory name
|
DirName: opts.TopDir, // Use bucket name as directory name
|
||||||
Entries: entries,
|
Entries: entries,
|
||||||
DirAppend: opts.DirAppend,
|
DirAppend: opts.DirAppend,
|
||||||
OutputFile: opts.OutputFile,
|
OutputFile: opts.OutputFile,
|
||||||
|
IsRoot: isRoot,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate HTML content in memory
|
// Generate HTML content in memory
|
||||||
|
|||||||
@@ -214,11 +214,13 @@ func ProcessDir(topDir string, opts *Options) error {
|
|||||||
Entries []FileEntry
|
Entries []FileEntry
|
||||||
DirAppend bool
|
DirAppend bool
|
||||||
OutputFile string
|
OutputFile string
|
||||||
|
IsRoot bool
|
||||||
}{
|
}{
|
||||||
DirName: dirName,
|
DirName: dirName,
|
||||||
Entries: entries,
|
Entries: entries,
|
||||||
DirAppend: opts.DirAppend,
|
DirAppend: opts.DirAppend,
|
||||||
OutputFile: opts.OutputFile,
|
OutputFile: opts.OutputFile,
|
||||||
|
IsRoot: false, // Local filesystem always shows parent directory
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.DryRun {
|
if opts.DryRun {
|
||||||
@@ -957,6 +959,7 @@ const htmlTemplateString = `<!DOCTYPE html>
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
{{if not .IsRoot}}
|
||||||
<tr class="clickable">
|
<tr class="clickable">
|
||||||
<td></td>
|
<td></td>
|
||||||
<td><a href="../{{if .DirAppend}}{{.OutputFile}}{{end}}">
|
<td><a href="../{{if .DirAppend}}{{.OutputFile}}{{end}}">
|
||||||
@@ -969,6 +972,7 @@ const htmlTemplateString = `<!DOCTYPE html>
|
|||||||
<td class="hideable">—</td>
|
<td class="hideable">—</td>
|
||||||
<td class="hideable"></td>
|
<td class="hideable"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{{end}}
|
||||||
{{range .Entries}}
|
{{range .Entries}}
|
||||||
<tr class="file">
|
<tr class="file">
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|||||||
Reference in New Issue
Block a user