diff --git a/caddy/setup/browse.go b/caddy/setup/browse.go index 63acaddd1..28cb2582b 100644 --- a/caddy/setup/browse.go +++ b/caddy/setup/browse.go @@ -264,7 +264,6 @@ footer { - @@ -300,14 +299,14 @@ footer { - -
-

{{.LinkedPath}}

+

+ {{range $url, $name := .BreadcrumbMap}}{{$name}}{{if ne $url "/"}}/{{end}}{{end}} +

-
+
{{.NumDirs}} director{{if eq 1 .NumDirs}}y{{else}}ies{{end}} {{.NumFiles}} file{{if ne 1 .NumFiles}}s{{end}}
diff --git a/middleware/browse/browse.go b/middleware/browse/browse.go index e6070079d..6fe37ea3b 100644 --- a/middleware/browse/browse.go +++ b/middleware/browse/browse.go @@ -6,7 +6,6 @@ import ( "bytes" "encoding/json" "errors" - "fmt" "net/http" "net/url" "os" @@ -69,33 +68,6 @@ type Listing struct { middleware.Context } -// LinkedPath returns l.Path where every element is a clickable -// link to the path up to that point so far. -func (l Listing) LinkedPath() string { - if len(l.Path) == 0 { - return "" - } - - // skip trailing slash - lpath := l.Path - if lpath[len(lpath)-1] == '/' { - lpath = lpath[:len(lpath)-1] - } - - parts := strings.Split(lpath, "/") - var result string - for i, part := range parts { - if i == 0 && part == "" { - // Leading slash (root) - result += `/` - continue - } - result += fmt.Sprintf(`%s/`, strings.Join(parts[:i+1], "/"), part) - } - - return result -} - // BreadcrumbMap returns l.Path where every element is a map // of URLs and path segment names. func (l Listing) BreadcrumbMap() map[string]string {