diff --git a/name.go b/name.go index 1ceb0ba..ac52a86 100644 --- a/name.go +++ b/name.go @@ -23,16 +23,19 @@ func CanonicalName(name string) string { func naviTitle(canonicalName string) string { var ( html = fmt.Sprintf(`

- %s`, util.HomePage, util.SiteTitle) + %s`, util.HomePage, util.SiteTitle) prevAcc = `/page/` parts = strings.Split(canonicalName, "/") ) - for _, part := range parts { - html += fmt.Sprintf(` - - %s`, + for i, part := range parts { + if i > 0 { + html += `` + } + html += fmt.Sprintf( + `%s`, prevAcc+part, - strings.Title(part)) + util.BeautifulName(part), + ) prevAcc += part + "/" } return html + "

" diff --git a/templates/asset.qtpl.go b/templates/asset.qtpl.go index a6cf70f..1a83ff5 100644 --- a/templates/asset.qtpl.go +++ b/templates/asset.qtpl.go @@ -63,6 +63,7 @@ article pre.codeblock {background-color:#eee; padding:.5rem; white-space: pre-wr .binary-container_with-video video, .binary-container_with-audio audio {width: 100%} .navi-title a {text-decoration:none;} +.navi-title__separator { margin: 0 .25rem; } .img-gallery { text-align: center; margin-top: .25rem; margin-bottom: .25rem; } .img-gallery_many-images { background-color: #eee; border-radius: .25rem; padding: .5rem; } .img-gallery img { max-width: 100%; max-height: 50vh; } diff --git a/templates/default.css b/templates/default.css index 0d3ef7b..8c17e5f 100644 --- a/templates/default.css +++ b/templates/default.css @@ -38,6 +38,7 @@ article pre.codeblock {background-color:#eee; padding:.5rem; white-space: pre-wr .binary-container_with-video video, .binary-container_with-audio audio {width: 100%} .navi-title a {text-decoration:none;} +.navi-title__separator { margin: 0 .25rem; } .img-gallery { text-align: center; margin-top: .25rem; margin-bottom: .25rem; } .img-gallery_many-images { background-color: #eee; border-radius: .25rem; padding: .5rem; } .img-gallery img { max-width: 100%; max-height: 50vh; } diff --git a/util/util.go b/util/util.go index 032e9f7..cdf0a6d 100644 --- a/util/util.go +++ b/util/util.go @@ -4,6 +4,7 @@ import ( "crypto/rand" "encoding/hex" "net/http" + "path" "strings" ) @@ -55,3 +56,8 @@ func RandomString(n int) (string, error) { } return hex.EncodeToString(bytes), nil } + +// Strip hypha name from all ancestor names, replace _ with spaces, title case +func BeautifulName(uglyName string) string { + return strings.Title(strings.ReplaceAll(path.Base(uglyName), "_", " ")) +}