Improve navititle
This commit is contained in:
parent
012c6453c8
commit
f96c470542
9
name.go
9
name.go
@ -23,17 +23,22 @@ func CanonicalName(name string) string {
|
|||||||
func naviTitle(canonicalName string) string {
|
func naviTitle(canonicalName string) string {
|
||||||
var (
|
var (
|
||||||
html = fmt.Sprintf(`<h1 class="navi-title" id="navi-title">
|
html = fmt.Sprintf(`<h1 class="navi-title" id="navi-title">
|
||||||
<a href="/page/%s">%s</a><span aria-hidden="true" class="navi-title__colon">: </span>`, util.HomePage, util.SiteTitle)
|
<a href="/page/%s">%s</a><span aria-hidden="true" class="navi-title__colon">:</span>`, util.HomePage, util.SiteTitle)
|
||||||
prevAcc = `/page/`
|
prevAcc = `/page/`
|
||||||
parts = strings.Split(canonicalName, "/")
|
parts = strings.Split(canonicalName, "/")
|
||||||
|
rel = "up"
|
||||||
)
|
)
|
||||||
for i, part := range parts {
|
for i, part := range parts {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
html += `<span aria-hidden="true" class="navi-title__separator">/</span>`
|
html += `<span aria-hidden="true" class="navi-title__separator">/</span>`
|
||||||
}
|
}
|
||||||
|
if i == len(parts)-1 {
|
||||||
|
rel = "bookmark"
|
||||||
|
}
|
||||||
html += fmt.Sprintf(
|
html += fmt.Sprintf(
|
||||||
`<a href="%s">%s</a>`,
|
`<a href="%s" rel="%s">%s</a>`,
|
||||||
prevAcc+part,
|
prevAcc+part,
|
||||||
|
rel,
|
||||||
util.BeautifulName(part),
|
util.BeautifulName(part),
|
||||||
)
|
)
|
||||||
prevAcc += part + "/"
|
prevAcc += part + "/"
|
||||||
|
|||||||
@ -66,8 +66,12 @@ article pre.codeblock {background-color:#eee; padding:.5rem; white-space: pre-wr
|
|||||||
.binary-container_with-img img,
|
.binary-container_with-img img,
|
||||||
.binary-container_with-video video,
|
.binary-container_with-video video,
|
||||||
.binary-container_with-audio audio {width: 100%}
|
.binary-container_with-audio audio {width: 100%}
|
||||||
.navi-title a {text-decoration:none;}
|
|
||||||
|
.navi-title { border-bottom: #eee 1px solid; padding-bottom: .5rem; margin-bottom: .25rem; }
|
||||||
|
.navi-title a {text-decoration:none; }
|
||||||
.navi-title__separator { margin: 0 .25rem; }
|
.navi-title__separator { margin: 0 .25rem; }
|
||||||
|
.navi-title__colon { margin-right: .5rem; }
|
||||||
|
|
||||||
.img-gallery { text-align: center; margin-top: .25rem; margin-bottom: .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_many-images { background-color: #eee; border-radius: .25rem; padding: .5rem; }
|
||||||
.img-gallery img { max-width: 100%; max-height: 50vh; }
|
.img-gallery img { max-width: 100%; max-height: 50vh; }
|
||||||
|
|||||||
@ -41,8 +41,12 @@ article pre.codeblock {background-color:#eee; padding:.5rem; white-space: pre-wr
|
|||||||
.binary-container_with-img img,
|
.binary-container_with-img img,
|
||||||
.binary-container_with-video video,
|
.binary-container_with-video video,
|
||||||
.binary-container_with-audio audio {width: 100%}
|
.binary-container_with-audio audio {width: 100%}
|
||||||
.navi-title a {text-decoration:none;}
|
|
||||||
|
.navi-title { border-bottom: #eee 1px solid; padding-bottom: .5rem; margin-bottom: .25rem; }
|
||||||
|
.navi-title a {text-decoration:none; }
|
||||||
.navi-title__separator { margin: 0 .25rem; }
|
.navi-title__separator { margin: 0 .25rem; }
|
||||||
|
.navi-title__colon { margin-right: .5rem; }
|
||||||
|
|
||||||
.img-gallery { text-align: center; margin-top: .25rem; margin-bottom: .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_many-images { background-color: #eee; border-radius: .25rem; padding: .5rem; }
|
||||||
.img-gallery img { max-width: 100%; max-height: 50vh; }
|
.img-gallery img { max-width: 100%; max-height: 50vh; }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user