Updated @navigation().
This commit is contained in:
parent
526636bdd7
commit
6f15fb4f2b
@ -49,19 +49,20 @@ templ base(title, description, keywords, canonical string, head templ.Component)
|
|||||||
|
|
||||||
templ navigation(title string) {
|
templ navigation(title string) {
|
||||||
{{ sections := []string{"Stuff", "Mindflow", "About", "Guestbook"} }}
|
{{ sections := []string{"Stuff", "Mindflow", "About", "Guestbook"} }}
|
||||||
|
{{ links := []templ.SafeURL{"/stuff", "/mindflow", "/about", "/guestbook"} }}
|
||||||
<nav>
|
<nav>
|
||||||
<div>
|
<div>
|
||||||
if title != "Home" {
|
if title != "" {
|
||||||
<a href="/">Home</a>
|
<a href="/">Home</a>
|
||||||
}
|
}
|
||||||
for _, s := range sections {
|
for i, s := range sections {
|
||||||
if strings.HasSuffix(title, s) {
|
if strings.HasSuffix(title, s) {
|
||||||
{{ continue }}
|
{{ continue }}
|
||||||
}
|
}
|
||||||
<a href={ templ.URL("/"+strings.ToLower(s)) }>{ s }</a>
|
<a href={ links[i] }>{ s }</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
if title != "" && title != "Home" {
|
if title != "" {
|
||||||
<h1>
|
<h1>
|
||||||
if strings.HasSuffix(title, "- Stuff") {
|
if strings.HasSuffix(title, "- Stuff") {
|
||||||
Stuff
|
Stuff
|
||||||
|
Loading…
Reference in New Issue
Block a user