From fa5ac4040e8e2fc57bef5c598e1ceda4c2fc0a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Herg=C3=A8s?= Date: Sun, 5 Oct 2025 15:16:20 +0200 Subject: feat(backend): add noreferer on external link and move target blank --- backend/config.go | 6 ++++++ backend/templates/base.html | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'backend') 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 @@
Logo - +
{{ template "body" . }} {{ $script := asset "index.js" }} -- cgit v1.2.3