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>
|
||||
}
|
||||
|
||||
templ navigation(heading string) {
|
||||
{{ links := []string{"Stuff", "Mindflow", "About", "Guestbook"} }}
|
||||
templ navigation(title string) {
|
||||
{{ sections := []string{"Stuff", "Mindflow", "About", "Guestbook"} }}
|
||||
<nav>
|
||||
<div>
|
||||
if heading != "Home" {
|
||||
if title != "Home" {
|
||||
<a href="/">Home</a>
|
||||
}
|
||||
for _, n := range links {
|
||||
if n == heading {
|
||||
for _, s := range sections {
|
||||
if strings.HasSuffix(title, s) {
|
||||
{{ continue }}
|
||||
}
|
||||
<a href={ templ.URL("/"+strings.ToLower(n)) }>{ n }</a>
|
||||
<a href={ templ.URL("/"+strings.ToLower(s)) }>{ s }</a>
|
||||
}
|
||||
</div>
|
||||
if heading != "" && heading != "Home" {
|
||||
if strings.HasSuffix(heading, "Article") {
|
||||
<h1>Article</h1>
|
||||
if title != "" && title != "Home" {
|
||||
<h1>
|
||||
if strings.HasSuffix(title, "- Stuff") {
|
||||
Stuff
|
||||
} else {
|
||||
<h1>{ heading }</h1>
|
||||
{ title }
|
||||
}
|
||||
</h1>
|
||||
}
|
||||
</nav>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user