Add logo feature
This commit is contained in:
@@ -168,6 +168,7 @@ type Options struct {
|
||||
Verbose bool
|
||||
DryRun bool
|
||||
ShowIndexFiles bool
|
||||
WatermarkURL string
|
||||
}
|
||||
|
||||
type FileEntry struct {
|
||||
@@ -211,17 +212,19 @@ func ProcessDir(topDir string, opts *Options) error {
|
||||
})
|
||||
|
||||
templateData := struct {
|
||||
DirName string
|
||||
Entries []FileEntry
|
||||
DirAppend bool
|
||||
OutputFile string
|
||||
IsRoot bool
|
||||
DirName string
|
||||
Entries []FileEntry
|
||||
DirAppend bool
|
||||
OutputFile string
|
||||
IsRoot bool
|
||||
WatermarkURL string
|
||||
}{
|
||||
DirName: dirName,
|
||||
Entries: entries,
|
||||
DirAppend: opts.DirAppend,
|
||||
OutputFile: opts.OutputFile,
|
||||
IsRoot: false, // Local filesystem always shows parent directory
|
||||
DirName: dirName,
|
||||
Entries: entries,
|
||||
DirAppend: opts.DirAppend,
|
||||
OutputFile: opts.OutputFile,
|
||||
IsRoot: false, // Local filesystem always shows parent directory
|
||||
WatermarkURL: opts.WatermarkURL,
|
||||
}
|
||||
|
||||
if opts.DryRun {
|
||||
@@ -467,6 +470,15 @@ const htmlTemplateString = `<!DOCTYPE html>
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.watermark {
|
||||
height: 24px;
|
||||
width: auto;
|
||||
margin-right: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
h1 a {
|
||||
@@ -943,7 +955,7 @@ const htmlTemplateString = `<!DOCTYPE html>
|
||||
</defs>
|
||||
</svg>
|
||||
<header>
|
||||
<h1>{{.DirName}}</h1>
|
||||
<h1>{{if .WatermarkURL}}<img src="{{.WatermarkURL}}" class="watermark" alt="Logo">{{end}}{{.DirName}}</h1>
|
||||
</header>
|
||||
<main>
|
||||
<div class="listing">
|
||||
|
||||
Reference in New Issue
Block a user