Updated templ navigation().
This commit is contained in:
parent
b1d7f92cff
commit
5fedded1de
@ -45,26 +45,28 @@ templ base(title, description, keywords, canonical string, head templ.Component)
|
|||||||
</html>
|
</html>
|
||||||
}
|
}
|
||||||
|
|
||||||
templ navigation(heading string) {
|
templ navigation(title string) {
|
||||||
{{ links := []string{"Stuff", "Mindflow", "About", "Guestbook"} }}
|
{{ sections := []string{"Stuff", "Mindflow", "About", "Guestbook"} }}
|
||||||
<nav>
|
<nav>
|
||||||
<div>
|
<div>
|
||||||
if heading != "Home" {
|
if title != "Home" {
|
||||||
<a href="/">Home</a>
|
<a href="/">Home</a>
|
||||||
}
|
}
|
||||||
for _, n := range links {
|
for _, s := range sections {
|
||||||
if n == heading {
|
if strings.HasSuffix(title, s) {
|
||||||
{{ continue }}
|
{{ continue }}
|
||||||
}
|
}
|
||||||
<a href={ templ.URL("/"+strings.ToLower(n)) }>{ n }</a>
|
<a href={ templ.URL("/"+strings.ToLower(s)) }>{ s }</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
if heading != "" && heading != "Home" {
|
if title != "" && title != "Home" {
|
||||||
if strings.HasSuffix(heading, "Article") {
|
<h1>
|
||||||
<h1>Article</h1>
|
if strings.HasSuffix(title, "- Stuff") {
|
||||||
|
Stuff
|
||||||
} else {
|
} else {
|
||||||
<h1>{ heading }</h1>
|
{ title }
|
||||||
}
|
}
|
||||||
|
</h1>
|
||||||
}
|
}
|
||||||
</nav>
|
</nav>
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user