1
0

Updated @navigation().

This commit is contained in:
Alexander Andreev 2024-06-25 22:43:18 +04:00
parent 526636bdd7
commit 6f15fb4f2b
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -49,19 +49,20 @@ templ base(title, description, keywords, canonical string, head templ.Component)
templ navigation(title string) {
{{ sections := []string{"Stuff", "Mindflow", "About", "Guestbook"} }}
{{ links := []templ.SafeURL{"/stuff", "/mindflow", "/about", "/guestbook"} }}
<nav>
<div>
if title != "Home" {
if title != "" {
<a href="/">Home</a>
}
for _, s := range sections {
for i, s := range sections {
if strings.HasSuffix(title, s) {
{{ continue }}
}
<a href={ templ.URL("/"+strings.ToLower(s)) }>{ s }</a>
<a href={ links[i] }>{ s }</a>
}
</div>
if title != "" && title != "Home" {
if title != "" {
<h1>
if strings.HasSuffix(title, "- Stuff") {
Stuff