Repos / s4g / f7ab474231
commit f7ab4742316d16a2ac259471f692375e20de4dd0
Author: Nhân <hi@imnhan.com>
Date: Wed Aug 30 18:40:34 2023 +0700
quick and dirty newtab
diff --git a/main.go b/main.go
index 7d42b67..de8ec71 100644
--- a/main.go
+++ b/main.go
@@ -184,10 +184,13 @@ func runServer(fsys writablefs.FS, webRoot, addr string) *http.Server {
}
type Link struct {
- Text string
- Url string
+ Text string
+ Url string
+ NewTab bool
}
+const NewTabSuffix = "🡕"
+
func regenerate(fsys writablefs.FS) (site *SiteMetadata, err error) {
defer timer("Took %s")()
@@ -218,6 +221,9 @@ func regenerate(fsys writablefs.FS) (site *SiteMetadata, err error) {
if item[0] == '#' {
var link Link
link.Text, link.Url, _ = strings.Cut(item[1:], "#")
+ if strings.HasSuffix(link.Text, NewTabSuffix) {
+ link.NewTab = true
+ }
navLinks = append(navLinks, link)
continue
}