diff options
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/config.go | 6 | ||||
| -rw-r--r-- | backend/templates/base.html | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/backend/config.go b/backend/config.go index 8c111ae..d6cf25a 100644 --- a/backend/config.go +++ b/backend/config.go @@ -1,9 +1,11 @@ package backend import ( + "html/template" "log/slog" "os" + "git.anhgelus.world/anhgelus/small-world/markdown" "github.com/pelletier/go-toml/v2" ) @@ -12,6 +14,10 @@ type Link struct { URL string `toml:"url"` } +func (l *Link) Render() template.HTML { + return markdown.RenderLink(l.Name, l.URL) +} + type Logo struct { Header string `toml:"header"` Favicon string `toml:"favicon"` diff --git a/backend/templates/base.html b/backend/templates/base.html index cf0d834..3af37f9 100644 --- a/backend/templates/base.html +++ b/backend/templates/base.html @@ -27,15 +27,13 @@ <body hx-push-url="true"> <header> <img src="{{ static .Logo.Header }}" alt="Logo"> - <nav> - {{ range .Links }}<a href="{{ .URL }}">{{ .Name }}</a>{{end}} - </nav> + <nav>{{ range .Links }}{{ .Render }}{{end}}</nav> </header> {{ template "body" . }} <footer> <p>© 2025 - Anhgelus Morthuuzh</p> <p id="quote">« {{ .Quote }} »</p> - <p><a href="/legal">Mentions légales</a>, <a href="https://git.anhgelus.world/anhgelus/small-web">code source</a>.</p> + <p><a href="/legal">Mentions légales</a>, <a href="https://git.anhgelus.world/anhgelus/small-web" target="_blank" rel="noreferrer">code source</a>.</p> </footer> {{ $script := asset "index.js" }}<script src="{{ $script.Src }}" integrity="{{ $script.Checksum }}" defer></script> </body> |
