forked from solderpunk/molly-brown
Read header for directory listings from .mollyhead.
This commit is contained in:
parent
b0b18971f4
commit
e57a3d5ecf
|
@ -270,6 +270,15 @@ func generateDirectoryListing(URL *url.URL, path string) string {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
listing = "# Directory listing\n\n"
|
listing = "# Directory listing\n\n"
|
||||||
|
// Override with .mollyhead file
|
||||||
|
header_path := filepath.Join(path, ".mollyhead")
|
||||||
|
_, err = os.Stat(header_path)
|
||||||
|
if err == nil {
|
||||||
|
header, err := ioutil.ReadFile(header_path)
|
||||||
|
if err == nil {
|
||||||
|
listing = string(header)
|
||||||
|
}
|
||||||
|
}
|
||||||
// Do "up" link first
|
// Do "up" link first
|
||||||
if URL.Path != "/" {
|
if URL.Path != "/" {
|
||||||
if strings.HasSuffix(URL.Path, "/") {
|
if strings.HasSuffix(URL.Path, "/") {
|
||||||
|
|
Loading…
Reference in New Issue