diff --git a/go.mod b/go.mod
index 1331228..fe091f3 100644
--- a/go.mod
+++ b/go.mod
@@ -32,6 +32,7 @@ require (
go.uber.org/zap v1.28.0
golang.org/x/crypto v0.59.0
golang.org/x/crypto/x509roots/fallback v0.0.0-20261123165210-6c21c5864259
+ golang.org/x/image v0.25.0
golang.org/x/net v0.63.0
golang.org/x/oauth2 v0.38.0
golang.org/x/sync v0.25.0
diff --git a/go.sum b/go.sum
index 5b55506..0e02249 100644
--- a/go.sum
+++ b/go.sum
@@ -349,6 +349,8 @@ golang.org/x/crypto/x509roots/fallback v0.0.0-20261123165210-6c21c5864259 h1:wXc
golang.org/x/crypto/x509roots/fallback v0.0.0-20261123165210-6c21c5864259/go.mod h1:HPze8vhfG6fO06AM+VSvxRm4E3+5Yk375mgrJ5M2z1E=
golang.org/x/exp v0.0.0-20261109185158-a52e3aef5920 h1:qr+tk4P56rtbVVAJDyAr5LAOiaD/XhZCoRTr4SfLxAk=
golang.org/x/exp v0.0.0-20261109185158-a52e3aef5920/go.mod h1:J3U+E8RzytcGvwz+uJuAP4zULJ2TkAQBnmPZMexpdXs=
+golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
+golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg=
diff --git a/internal/api/legal.go b/internal/api/legal.go
index 8fb26c3..bf7bdbc 100644
--- a/internal/api/legal.go
+++ b/internal/api/legal.go
@@ -205,7 +205,9 @@ func (s *Server) legalPage(c *gin.Context) {
}
me = &m
}
- web.Render(c, http.StatusOK, web.LegalPage(s.pageFor(c, web.LegalTitleID(kind)), me, html))
+ p := s.pageFor(c, web.LegalTitleID(kind))
+ p.Meta = s.publicMeta(c, "/legal/"+kind, web.LegalTitleID(kind))
+ web.Render(c, http.StatusOK, web.LegalPage(p, me, html))
return
}
c.Status(http.StatusNotFound)
diff --git a/internal/api/pages.go b/internal/api/pages.go
index ba979f1..6b8e58f 100644
--- a/internal/api/pages.go
+++ b/internal/api/pages.go
@@ -104,7 +104,9 @@ func (s *Server) loginPage(c *gin.Context) {
}
allowed := email || len(signupProviders) > 0
providers := s.platformButtons(c.Request.Context(), false)
- web.Render(c, http.StatusOK, web.Login(s.pageFor(c, "auth.login.title"), allowed, next, providers, c.Query("mfa") == "1"))
+ p := s.pageFor(c, "auth.login.title")
+ p.Meta = s.publicMeta(c, "/login", "auth.login.title")
+ web.Render(c, http.StatusOK, web.Login(p, allowed, next, providers, c.Query("mfa") == "1"))
}
// signupOptions tells whether people may sign up with email, and which
@@ -141,7 +143,9 @@ func (s *Server) signupPage(c *gin.Context) {
internalError(c, err)
return
}
- web.Render(c, http.StatusOK, web.Signup(s.pageFor(c, "auth.signup.title"), providers, email, consent))
+ p := s.pageFor(c, "auth.signup.title")
+ p.Meta = s.publicMeta(c, "/signup", "auth.signup.title")
+ web.Render(c, http.StatusOK, web.Signup(p, providers, email, consent))
}
func (s *Server) signupSentPage(c *gin.Context) {
diff --git a/internal/api/seo.go b/internal/api/seo.go
new file mode 100644
index 0000000..4d45946
--- /dev/null
+++ b/internal/api/seo.go
@@ -0,0 +1,121 @@
+package api
+
+import (
+ "net/http"
+ "net/url"
+ "strings"
+ "sync"
+ "time"
+
+ "github.com/gin-gonic/gin"
+
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/ogimage"
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/web"
+)
+
+// indexable reports whether search engines may list the public pages.
+// Self-hosted installations keep their sign-in out of search results.
+func (s *Server) indexable() bool { return s.cloud() }
+
+// publicMeta describes a public page at path, such as the sign-in, for
+// search engines and link previews; nil where pages are not indexed.
+func (s *Server) publicMeta(c *gin.Context, path, titleID string) *web.PageMeta {
+ if !s.indexable() {
+ return nil
+ }
+ ctx := c.Request.Context()
+ lang := i18n.Lang(ctx)
+ chosen := s.catalog.IsSupported(c.Query("lang"))
+ title := i18n.T(ctx, titleID) + " · UptimeSebi"
+ image := web.LangURL(s.cfg.PublicURL+"/og.png", lang)
+ return web.NewPageMeta(title, i18n.T(ctx, "meta.app_description"), s.cfg.PublicURL+path, image, "UptimeSebi", lang, chosen, s.catalog.Supported())
+}
+
+// appImages keeps the app's preview image per language.
+type appImages struct {
+ mu sync.Mutex
+ images map[string][]byte
+}
+
+// appOGImage serves the preview image of the app's public pages.
+func (s *Server) appOGImage(c *gin.Context) {
+ l := s.catalog.Match(c.Query("lang"), c.GetHeader("Accept-Language"))
+ ctx := i18n.NewContext(c.Request.Context(), l)
+ s.ogImages.mu.Lock()
+ defer s.ogImages.mu.Unlock()
+ png, ok := s.ogImages.images[l.Lang()]
+ if !ok {
+ host := s.cfg.PublicURL
+ if u, err := url.Parse(host); err == nil {
+ host = u.Host
+ }
+ var err error
+ png, err = ogimage.Render(ogimage.Card{
+ Title: i18n.T(ctx, "meta.app_card_title"),
+ Subtitle: i18n.T(ctx, "meta.app_card_subtitle"),
+ Footer: host,
+ Accent: ogimage.Up,
+ })
+ if err != nil {
+ internalError(c, err)
+ return
+ }
+ if s.ogImages.images == nil {
+ s.ogImages.images = map[string][]byte{}
+ }
+ s.ogImages.images[l.Lang()] = png
+ }
+ c.Header("Cache-Control", "public, max-age=86400")
+ c.Data(http.StatusOK, "image/png", png)
+}
+
+// robotsTxt lets crawlers read the sign-in, sign-up and legal pages and
+// nothing else; self-hosted installations turn them away entirely.
+func (s *Server) robotsTxt(c *gin.Context) {
+ var b strings.Builder
+ b.WriteString("User-agent: *\n")
+ if s.indexable() {
+ for _, p := range []string{"/login", "/signup", "/legal/", "/og.png", "/static/"} {
+ b.WriteString("Allow: " + p + "\n")
+ }
+ }
+ b.WriteString("Disallow: /\n")
+ if s.indexable() {
+ b.WriteString("\nSitemap: " + s.cfg.PublicURL + "/sitemap.xml\n")
+ }
+ c.Header("Cache-Control", "public, max-age=3600")
+ c.Data(http.StatusOK, "text/plain; charset=utf-8", []byte(b.String()))
+}
+
+// sitemapXML lists the public pages with their language versions.
+func (s *Server) sitemapXML(c *gin.Context) {
+ if !s.indexable() {
+ c.Status(http.StatusNotFound)
+ return
+ }
+ ctx := c.Request.Context()
+ paths := []string{"/login"}
+ if email, providers, err := s.signupOptions(ctx); err != nil {
+ internalError(c, err)
+ return
+ } else if email || len(providers) > 0 {
+ paths = append(paths, "/signup")
+ }
+ for _, d := range s.platformLegalDocs(ctx) {
+ if d.URL == "" {
+ paths = append(paths, "/legal/"+d.Kind)
+ }
+ }
+ var urls []string
+ for _, p := range paths {
+ urls = append(urls, s.cfg.PublicURL+p)
+ }
+ body, err := web.Sitemap(urls, s.catalog.Supported(), time.Time{})
+ if err != nil {
+ internalError(c, err)
+ return
+ }
+ c.Header("Cache-Control", "public, max-age=3600")
+ c.Data(http.StatusOK, "application/xml; charset=utf-8", body)
+}
diff --git a/internal/api/seo_test.go b/internal/api/seo_test.go
new file mode 100644
index 0000000..d6b7b08
--- /dev/null
+++ b/internal/api/seo_test.go
@@ -0,0 +1,81 @@
+package api_test
+
+import (
+ "bytes"
+ "io"
+ "net/http"
+ "strings"
+ "testing"
+
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/config"
+)
+
+func (b *browser) raw(path string) (int, http.Header, []byte) {
+ b.t.Helper()
+ resp, err := b.hc.Get(b.base + path)
+ if err != nil {
+ b.t.Fatalf("GET %s failed: %v", path, err)
+ }
+ defer func() { _ = resp.Body.Close() }()
+ body, _ := io.ReadAll(resp.Body)
+ return resp.StatusCode, resp.Header, body
+}
+
+func TestPublicPagesForSearchEngines(t *testing.T) {
+ const publicURL = "https://app.example.test"
+ cloud := newEnvWith(t, func(c *config.API) {
+ c.Edition, c.SignupVerify, c.PublicURL = config.EditionCloud, "off", publicURL
+ })
+ b := cloud.browser(t)
+
+ _, _, html := b.page("/login?next=/monitors&lang=de")
+ for _, want := range []string{
+ ``,
+ ``,
+ ``,
+ ``,
+ ``,
+ } {
+ if !strings.Contains(html, want) {
+ t.Errorf("login page lacks %s", want)
+ }
+ }
+ if strings.Contains(html, "noindex") {
+ t.Errorf("login page is noindex in the cloud edition")
+ }
+ if _, _, html := b.page("/signup"); !strings.Contains(html, ``) {
+ t.Errorf("signup page lacks its canonical address")
+ }
+
+ _, _, robots := b.raw("/robots.txt")
+ if !strings.Contains(string(robots), "Allow: /login\n") || !strings.Contains(string(robots), "Disallow: /\n") || !strings.Contains(string(robots), "Sitemap: "+publicURL+"/sitemap.xml") {
+ t.Errorf("robots.txt = %q", robots)
+ }
+ code, _, sm := b.raw("/sitemap.xml")
+ if code != http.StatusOK || !strings.Contains(string(sm), ""+publicURL+"/signup") || !strings.Contains(string(sm), `hreflang="de" href="`+publicURL+`/login?lang=de"`) {
+ t.Errorf("sitemap = %d %s", code, sm)
+ }
+ code, h, png := b.raw("/og.png?lang=en")
+ if code != http.StatusOK || h.Get("Content-Type") != "image/png" || !bytes.HasPrefix(png, []byte("\x89PNG")) {
+ t.Errorf("preview image = %d %s", code, h.Get("Content-Type"))
+ }
+
+ // Signed in, the console stays out of search engines.
+ b.signup("seo@"+uniq("seo")+".test", uniq("seo-"))
+ if _, _, html := b.page("/"); !strings.Contains(html, ``) || strings.Contains(html, "og:title") {
+ t.Errorf("console page is indexable")
+ }
+
+ // Self-hosted installations keep everything out.
+ self := newEnv(t).browser(t)
+ if _, _, html := self.page("/login"); !strings.Contains(html, "noindex") || strings.Contains(html, "canonical") {
+ t.Errorf("self-hosted login page is indexable")
+ }
+ if _, _, robots := self.raw("/robots.txt"); string(robots) != "User-agent: *\nDisallow: /\n" {
+ t.Errorf("self-hosted robots.txt = %q", robots)
+ }
+ if code, _, _ := self.raw("/sitemap.xml"); code != http.StatusNotFound {
+ t.Errorf("self-hosted sitemap = %d, want 404", code)
+ }
+}
diff --git a/internal/api/server.go b/internal/api/server.go
index 61c1004..dfa924e 100644
--- a/internal/api/server.go
+++ b/internal/api/server.go
@@ -70,6 +70,8 @@ type Server struct {
// publicRegions caches the answer of the public region list.
publicRegions publicRegionsCache
+ // ogImages keeps the preview image of the public pages.
+ ogImages appImages
}
// Deps are the external resources a Server needs.
@@ -132,6 +134,9 @@ func (s *Server) Mount(r gin.IRouter) {
r.GET("/api/openapi.json", s.openAPIJSON)
// Public data for websites: no session, no CSRF.
r.GET("/api/v1/public/regions", s.listPublicRegions)
+ r.GET("/robots.txt", s.robotsTxt)
+ r.GET("/sitemap.xml", s.sitemapXML)
+ r.GET("/og.png", s.appOGImage)
r.GET("/install.sh", s.installScript)
g.GET("/api/docs", s.apiDocsPage)
@@ -336,7 +341,9 @@ func (s *Server) localize() gin.HandlerFunc {
pref = sess.Locale
}
cookie, _ := c.Cookie(localeCookie)
- l := s.catalog.Match(pref, cookie, c.GetHeader("Accept-Language"))
+ // ?lang= shows a page in that language, so each language of the
+ // public pages has an address of its own.
+ l := s.catalog.Match(c.Query("lang"), pref, cookie, c.GetHeader("Accept-Language"))
c.Request = c.Request.WithContext(i18n.NewContext(c.Request.Context(), l))
c.Header("Content-Language", l.Lang())
c.Header("Vary", "Accept-Language, Cookie")
diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json
index f92a669..0953d59 100644
--- a/internal/i18n/locales/de.json
+++ b/internal/i18n/locales/de.json
@@ -1000,6 +1000,9 @@
"members.step_down_confirm": "Als Owner zurücktreten? Ohne andere Rollen arbeitest du mit der Admin-Rolle weiter.",
"members.title": "Mitglieder",
"members.unassign": "Rolle entfernen",
+ "meta.app_card_subtitle": "Monitore, Alarme und Statusseiten, Open Source",
+ "meta.app_card_title": "Uptime-Monitoring und Statusseiten",
+ "meta.app_description": "UptimeSebi überwacht Websites, Server und Dienste aus mehreren Regionen, alarmiert bei Ausfällen und betreibt öffentliche Statusseiten. Open Source.",
"moderation.actions": "Sperren oder löschen …",
"moderation.created": "Erstellt",
"moderation.delete_confirm_org": "Organisation {{.Name}} mit allen Monitoren, Ergebnissen und Statusseiten endgültig löschen?",
@@ -1256,6 +1259,7 @@
"page.incidents": "Letzte Vorfälle",
"page.maintenance_ongoing": "Laufende Wartung",
"page.maintenance_upcoming": "Geplante Wartung",
+ "page.meta_description": "Aktueller Status von {{.Title}}: {{.Status}}. Störungen und geplante Wartungen auf einen Blick.",
"page.no_incidents": "Keine Vorfälle in den letzten 14 Tagen.",
"page.stale": "Live-Aktualisierung derzeit nicht verfügbar. Diese Seite zeigt den Stand von {{.Time}}.",
"page.status.degraded": "Einige Systeme haben Probleme",
diff --git a/internal/i18n/locales/en.json b/internal/i18n/locales/en.json
index 6d49a05..e3c256d 100644
--- a/internal/i18n/locales/en.json
+++ b/internal/i18n/locales/en.json
@@ -1000,6 +1000,9 @@
"members.step_down_confirm": "Step down as owner? You keep working with the Admin role unless you have other roles.",
"members.title": "Members",
"members.unassign": "Remove role",
+ "meta.app_card_subtitle": "Monitors, alerts and status pages, open source",
+ "meta.app_card_title": "Uptime monitoring and status pages",
+ "meta.app_description": "UptimeSebi watches websites, servers and services from several regions, alerts you on outages and runs public status pages. Open source.",
"moderation.actions": "Suspend or delete …",
"moderation.created": "Created",
"moderation.delete_confirm_org": "Delete the organization {{.Name}} with all its monitors, results and status pages for good?",
@@ -1256,6 +1259,7 @@
"page.incidents": "Recent incidents",
"page.maintenance_ongoing": "Maintenance in progress",
"page.maintenance_upcoming": "Planned maintenance",
+ "page.meta_description": "Current status of {{.Title}}: {{.Status}}. Incidents and planned maintenance at a glance.",
"page.no_incidents": "No incidents in the last 14 days.",
"page.stale": "Live updates are currently unavailable. This page shows the status as of {{.Time}}.",
"page.status.degraded": "Some systems are experiencing problems",
diff --git a/internal/ogimage/ogimage.go b/internal/ogimage/ogimage.go
new file mode 100644
index 0000000..4e89555
--- /dev/null
+++ b/internal/ogimage/ogimage.go
@@ -0,0 +1,209 @@
+// Package ogimage draws the preview images link previews show for status
+// pages and the app (Open Graph and Twitter cards): 1200×630 PNGs in the
+// style of the console.
+package ogimage
+
+import (
+ "bytes"
+ "image"
+ "image/color"
+ "image/draw"
+ "image/png"
+ "math"
+ "strings"
+ "sync"
+
+ "golang.org/x/image/font"
+ "golang.org/x/image/font/gofont/gobold"
+ "golang.org/x/image/font/gofont/goregular"
+ "golang.org/x/image/font/opentype"
+ "golang.org/x/image/math/fixed"
+)
+
+// Width and Height are the size link previews expect.
+const (
+ Width = 1200
+ Height = 630
+)
+
+// Colors of the console's palette.
+var (
+ Paper = color.RGBA{0xf4, 0xf2, 0xee, 0xff}
+ Ink = color.RGBA{0x1c, 0x1d, 0x1f, 0xff}
+ Muted = color.RGBA{0x6b, 0x67, 0x5f, 0xff}
+ Rule = color.RGBA{0xd9, 0xd5, 0xcc, 0xff}
+ Up = color.RGBA{0x2f, 0x7d, 0x4f, 0xff}
+ Down = color.RGBA{0xb3, 0x36, 0x1f, 0xff}
+ Degraded = color.RGBA{0xb5, 0x7b, 0x14, 0xff}
+ Unknown = color.RGBA{0x8a, 0x8a, 0x86, 0xff}
+ Maintenance = color.RGBA{0x3d, 0x6f, 0xa6, 0xff}
+)
+
+// Card is what an image shows: a title, a line below it marked with a dot
+// in Accent, and a footer such as the page's address.
+type Card struct {
+ Title string
+ Subtitle string
+ Footer string
+ Accent color.Color
+}
+
+var (
+ fontsOnce sync.Once
+ regular *opentype.Font
+ bold *opentype.Font
+ fontsErr error
+)
+
+func loadFonts() error {
+ fontsOnce.Do(func() {
+ if regular, fontsErr = opentype.Parse(goregular.TTF); fontsErr != nil {
+ return
+ }
+ bold, fontsErr = opentype.Parse(gobold.TTF)
+ })
+ return fontsErr
+}
+
+func face(f *opentype.Font, size float64) (font.Face, error) {
+ return opentype.NewFace(f, &opentype.FaceOptions{Size: size, DPI: 72, Hinting: font.HintingFull})
+}
+
+const margin = 80
+
+// Render draws c as a PNG.
+func Render(c Card) ([]byte, error) {
+ if err := loadFonts(); err != nil {
+ return nil, err
+ }
+ accent := c.Accent
+ if accent == nil {
+ accent = Ink
+ }
+ img := image.NewRGBA(image.Rect(0, 0, Width, Height))
+ draw.Draw(img, img.Bounds(), image.NewUniform(Paper), image.Point{}, draw.Src)
+ // A band in the accent colour along the top, and a rule above the footer.
+ fill(img, image.Rect(0, 0, Width, 14), accent)
+ fill(img, image.Rect(margin, Height-130, Width-margin, Height-128), Rule)
+
+ brand, err := face(bold, 30)
+ if err != nil {
+ return nil, err
+ }
+ drawText(img, brand, Ink, margin, 104, "UptimeSebi")
+
+ // The title shrinks for long names and wraps onto at most two lines.
+ y := 230
+ for _, size := range []float64{76, 64, 54} {
+ title, err := face(bold, size)
+ if err != nil {
+ return nil, err
+ }
+ lines := wrap(title, c.Title, Width-2*margin, 2)
+ if len(lines) == 1 || size == 54 {
+ lh := int(size * 1.15)
+ for _, l := range lines {
+ drawText(img, title, Ink, margin, y, l)
+ y += lh
+ }
+ break
+ }
+ }
+
+ if c.Subtitle != "" {
+ sub, err := face(regular, 38)
+ if err != nil {
+ return nil, err
+ }
+ y += 30
+ dot(img, margin+14, y-13, 14, accent)
+ lines := wrap(sub, c.Subtitle, Width-2*margin-48, 1)
+ drawText(img, sub, Ink, margin+48, y, lines[0])
+ }
+
+ if c.Footer != "" {
+ foot, err := face(regular, 28)
+ if err != nil {
+ return nil, err
+ }
+ drawText(img, foot, Muted, margin, Height-72, wrap(foot, c.Footer, Width-2*margin, 1)[0])
+ }
+
+ var buf bytes.Buffer
+ if err := png.Encode(&buf, img); err != nil {
+ return nil, err
+ }
+ return buf.Bytes(), nil
+}
+
+func fill(img *image.RGBA, r image.Rectangle, c color.Color) {
+ draw.Draw(img, r, image.NewUniform(c), image.Point{}, draw.Src)
+}
+
+// dot draws a filled circle of radius r around (cx, cy), smoothing its edge.
+func dot(img *image.RGBA, cx, cy, r int, c color.Color) {
+ cr, cg, cb, _ := c.RGBA()
+ for y := cy - r - 1; y <= cy+r+1; y++ {
+ for x := cx - r - 1; x <= cx+r+1; x++ {
+ // Coverage from the distance of the pixel centre to the edge.
+ dx, dy := float64(x-cx)+0.5, float64(y-cy)+0.5
+ d := float64(r) - math.Sqrt(dx*dx+dy*dy) + 0.5
+ if d <= 0 {
+ continue
+ }
+ if d > 1 {
+ d = 1
+ }
+ bg := img.RGBAAt(x, y)
+ mix := func(fg uint32, b uint8) uint8 { return uint8(float64(fg>>8)*d + float64(b)*(1-d)) }
+ img.SetRGBA(x, y, color.RGBA{mix(cr, bg.R), mix(cg, bg.G), mix(cb, bg.B), 0xff})
+ }
+ }
+}
+
+func drawText(img *image.RGBA, f font.Face, c color.Color, x, y int, s string) {
+ d := font.Drawer{Dst: img, Src: image.NewUniform(c), Face: f, Dot: fixed.P(x, y)}
+ d.DrawString(s)
+}
+
+// wrap breaks s into lines no wider than width, at most max of them; the
+// last one ends in an ellipsis when s does not fit.
+func wrap(f font.Face, s string, width, max int) []string {
+ words := strings.Fields(s)
+ if len(words) == 0 {
+ return []string{""}
+ }
+ limit := fixed.I(width)
+ var lines []string
+ line := ""
+ for i, w := range words {
+ next := strings.TrimSpace(line + " " + w)
+ if font.MeasureString(f, next) <= limit {
+ line = next
+ continue
+ }
+ if line != "" {
+ lines = append(lines, line)
+ }
+ line = w
+ if len(lines) == max {
+ // Out of lines: finish the last one with what is left.
+ rest := strings.Join(words[i:], " ")
+ lines[max-1] = ellipsize(f, lines[max-1]+" "+rest, limit)
+ return lines
+ }
+ }
+ return append(lines, ellipsize(f, line, limit))
+}
+
+// ellipsize shortens s until it fits limit, marking the cut with "…".
+func ellipsize(f font.Face, s string, limit fixed.Int26_6) string {
+ if font.MeasureString(f, s) <= limit {
+ return s
+ }
+ r := []rune(s)
+ for len(r) > 0 && font.MeasureString(f, string(r)+"…") > limit {
+ r = r[:len(r)-1]
+ }
+ return strings.TrimSpace(string(r)) + "…"
+}
diff --git a/internal/ogimage/ogimage_test.go b/internal/ogimage/ogimage_test.go
new file mode 100644
index 0000000..d75125c
--- /dev/null
+++ b/internal/ogimage/ogimage_test.go
@@ -0,0 +1,49 @@
+package ogimage
+
+import (
+ "bytes"
+ "image/png"
+ "os"
+ "strings"
+ "testing"
+)
+
+func TestRender(t *testing.T) {
+ for _, c := range []Card{
+ {Title: "Hetzner Cloud", Subtitle: "All systems operational", Footer: "uptimesebi-status.net/hetzner", Accent: Up},
+ {Title: strings.Repeat("A very long status page name ", 6), Subtitle: strings.Repeat("problems ", 20), Footer: "x", Accent: Down},
+ {Title: ""},
+ } {
+ b, err := Render(c)
+ if err != nil {
+ t.Fatalf("Render(%q) error = %v", c.Title, err)
+ }
+ img, err := png.Decode(bytes.NewReader(b))
+ if err != nil {
+ t.Fatalf("Render(%q) is no PNG: %v", c.Title, err)
+ }
+ if r := img.Bounds(); r.Dx() != Width || r.Dy() != Height {
+ t.Errorf("Render(%q) size = %v, want %dx%d", c.Title, r, Width, Height)
+ }
+ if dir := os.Getenv("OGIMAGE_OUT"); dir != "" {
+ _ = os.WriteFile(dir+"/"+string(rune('a'+len(c.Title)%26))+".png", b, 0o600)
+ }
+ }
+}
+
+func TestWrap(t *testing.T) {
+ if err := loadFonts(); err != nil {
+ t.Fatal(err)
+ }
+ f, err := face(bold, 76)
+ if err != nil {
+ t.Fatal(err)
+ }
+ lines := wrap(f, strings.Repeat("word ", 100), 1040, 2)
+ if len(lines) != 2 || !strings.HasSuffix(lines[1], "…") {
+ t.Errorf("wrap() = %q, want two lines ending in an ellipsis", lines)
+ }
+ if got := wrap(f, "Short", 1040, 2); len(got) != 1 || got[0] != "Short" {
+ t.Errorf("wrap(Short) = %q", got)
+ }
+}
diff --git a/internal/statuspage/meta.go b/internal/statuspage/meta.go
new file mode 100644
index 0000000..e97e0e8
--- /dev/null
+++ b/internal/statuspage/meta.go
@@ -0,0 +1,143 @@
+package statuspage
+
+import (
+ "image/color"
+ "net/http"
+ "strings"
+ "sync"
+ "time"
+
+ "github.com/gin-gonic/gin"
+
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/ogimage"
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/web"
+)
+
+// maxDescription bounds a page's description, about what search results
+// show.
+const maxDescription = 160
+
+// origin is the scheme and host the visitor reached the server at.
+func origin(c *gin.Context) string {
+ scheme := "http"
+ if c.Request.TLS != nil || strings.EqualFold(c.GetHeader("X-Forwarded-Proto"), "https") {
+ scheme = "https"
+ }
+ return scheme + "://" + c.Request.Host
+}
+
+var statusAccent = map[string]color.Color{
+ agentapi.PageOperational: ogimage.Up,
+ agentapi.PageDegraded: ogimage.Degraded,
+ agentapi.PageOutage: ogimage.Down,
+ agentapi.PageUnderMaintenance: ogimage.Maintenance,
+ agentapi.PageUnknown: ogimage.Unknown,
+}
+
+// pageMeta describes the status page at base for search engines and link
+// previews, in the language the request was localized to.
+func (s *Server) pageMeta(c *gin.Context, snap agentapi.PageSnapshot, base string) *web.PageMeta {
+ ctx := c.Request.Context()
+ lang := i18n.Lang(ctx)
+ desc := web.PlainText(snap.Description, maxDescription)
+ if desc == "" {
+ desc = i18n.T(ctx, "page.meta_description", "Title", snap.Title, "Status", i18n.T(ctx, "page.status."+snap.Status))
+ }
+ abs := origin(c) + base
+ image := web.LangURL(abs+"og.png", lang)
+ _, chosen := c.GetQuery("lang")
+ return web.NewPageMeta(snap.Title, desc, abs, image, snap.Title, lang, chosen && s.catalog.IsSupported(c.Query("lang")), s.catalog.Supported())
+}
+
+// ogCache keeps each page's preview image until its title, status or
+// language changes.
+type ogCache struct {
+ mu sync.Mutex
+ images map[string]ogEntry
+}
+
+type ogEntry struct {
+ sig string
+ png []byte
+}
+
+// serveOG draws the page's preview image: its name and current status.
+func (s *Server) serveOG(c *gin.Context, e entry, base string) {
+ s.localizeRequest(c)
+ ctx := c.Request.Context()
+ snap := e.Snap.WithMaintenance(s.now())
+ card := ogimage.Card{
+ Title: snap.Title,
+ Subtitle: i18n.T(ctx, "page.status."+snap.Status),
+ Footer: strings.TrimSuffix(c.Request.Host+base, "/"),
+ Accent: statusAccent[snap.Status],
+ }
+ sig := strings.Join([]string{card.Title, card.Subtitle, card.Footer, snap.Status}, "\x00")
+ key := e.Key + "\x00" + i18n.Lang(ctx)
+ s.og.mu.Lock()
+ cached, ok := s.og.images[key]
+ s.og.mu.Unlock()
+ if !ok || cached.sig != sig {
+ png, err := ogimage.Render(card)
+ if err != nil {
+ s.log.Warn("drawing preview image failed", "page", e.Key, "error", err)
+ c.Status(http.StatusInternalServerError)
+ return
+ }
+ cached = ogEntry{sig: sig, png: png}
+ s.og.mu.Lock()
+ if s.og.images == nil {
+ s.og.images = map[string]ogEntry{}
+ }
+ s.og.images[key] = cached
+ s.og.mu.Unlock()
+ }
+ c.Header("Cache-Control", "public, max-age=300")
+ c.Data(http.StatusOK, "image/png", cached.png)
+}
+
+func (s *Server) forgetOG(key string) {
+ s.og.mu.Lock()
+ defer s.og.mu.Unlock()
+ for k := range s.og.images {
+ if strings.HasPrefix(k, key+"\x00") {
+ delete(s.og.images, k)
+ }
+ }
+}
+
+func (s *Server) serveSitemap(c *gin.Context, base string) {
+ // No lastmod: a snapshot is regenerated every minute, which says
+ // nothing about whether the page changed.
+ body, err := web.Sitemap([]string{origin(c) + base}, s.catalog.Supported(), time.Time{})
+ if err != nil {
+ c.Status(http.StatusInternalServerError)
+ return
+ }
+ c.Header("Cache-Control", "public, max-age=3600")
+ c.Data(http.StatusOK, "application/xml; charset=utf-8", body)
+}
+
+// serveRobots lets crawlers read the pages but not the feeds, the API or
+// the subscription forms. A custom domain serves one page, so its sitemap
+// can be named; the shared hosts serve many under their slugs.
+func (s *Server) serveRobots(c *gin.Context) {
+ var b strings.Builder
+ b.WriteString("User-agent: *\n")
+ prefix := "/*"
+ custom := s.IsCustomDomain(hostOnly(c.Request.Host))
+ if custom {
+ prefix = ""
+ }
+ for _, p := range []string{"/api/", "/subscribe", "/unsubscribe", "/feed.rss"} {
+ b.WriteString("Disallow: " + prefix + p + "\n")
+ }
+ b.WriteString("Allow: /\n")
+ if custom {
+ b.WriteString("\nSitemap: " + origin(c) + "/sitemap.xml\n")
+ }
+ c.Header("Cache-Control", "public, max-age=3600")
+ c.Data(http.StatusOK, "text/plain; charset=utf-8", []byte(b.String()))
+}
diff --git a/internal/statuspage/public.go b/internal/statuspage/public.go
index 35bcf6b..2fb4bfc 100644
--- a/internal/statuspage/public.go
+++ b/internal/statuspage/public.go
@@ -34,6 +34,8 @@ const (
routeSubscribe
routeConfirm
routeUnsubscribe
+ routeOG
+ routeSitemap
)
// posts reports whether the route takes form posts.
@@ -63,6 +65,10 @@ func routeOf(parts []string) (route, bool) {
return route{kind: routeConfirm}, true
case len(parts) == 1 && parts[0] == "unsubscribe":
return route{kind: routeUnsubscribe}, true
+ case len(parts) == 1 && parts[0] == "og.png":
+ return route{kind: routeOG}, true
+ case len(parts) == 1 && parts[0] == "sitemap.xml":
+ return route{kind: routeSitemap}, true
case len(parts) == 3 && parts[0] == "api" && parts[1] == "v1" && apiResources[parts[2]]:
return route{kind: routeAPI, arg: parts[2]}, true
case len(parts) == 1 && parts[0] != "" && parts[0] != "api":
diff --git a/internal/statuspage/statuspage.go b/internal/statuspage/statuspage.go
index 9d4d7b2..2b40cfd 100644
--- a/internal/statuspage/statuspage.go
+++ b/internal/statuspage/statuspage.go
@@ -73,6 +73,8 @@ type Server struct {
src Source
catalog *i18n.Catalog
log *slog.Logger
+ // og keeps the pages' preview images.
+ og ogCache
// ownHosts are the hosts that serve pages by slug; any other host is
// looked up as a custom domain.
ownHosts map[string]bool
@@ -221,6 +223,7 @@ func (s *Server) persist(e entry) {
}
func (s *Server) forget(key string) {
+ s.forgetOG(key)
s.mu.Lock()
delete(s.cache, key)
delete(s.visited, key)
@@ -261,6 +264,10 @@ func hostOnly(h string) string {
}
func (s *Server) serve(c *gin.Context) {
+ if c.Request.URL.Path == "/robots.txt" && (c.Request.Method == http.MethodGet || c.Request.Method == http.MethodHead) {
+ s.serveRobots(c)
+ return
+ }
host := hostOnly(c.Request.Host)
var parts []string
if trimmed := strings.Trim(c.Request.URL.Path, "/"); trimmed != "" {
@@ -295,16 +302,23 @@ func (s *Server) serve(c *gin.Context) {
}
e, ok := s.lookup(c.Request.Context(), key, host, slug)
if !ok {
- if rt.kind == routeFeed || rt.kind == routeAPI {
+ if rt.kind == routeFeed || rt.kind == routeAPI || rt.kind == routeOG || rt.kind == routeSitemap {
c.Status(http.StatusNotFound)
} else {
s.notFound(c)
}
return
}
- if rt.kind == routeLegal {
+ switch rt.kind {
+ case routeLegal:
s.serveLegal(c, e, rt.arg, base)
return
+ case routeOG:
+ s.serveOG(c, e, base)
+ return
+ case routeSitemap:
+ s.serveSitemap(c, base)
+ return
}
var staleSince time.Time
if s.now().Sub(e.Fetched) > staleNoticeAfter {
@@ -319,6 +333,7 @@ func (s *Server) serve(c *gin.Context) {
}
switch rt.kind {
case routeComponent:
+ assets.NoIndex = true
s.serveComponent(c, e, rt.arg, assets)
return
case routeFeed:
@@ -328,6 +343,7 @@ func (s *Server) serve(c *gin.Context) {
s.serveAPI(c, e, rt.arg, base)
return
case routeSubscribe, routeConfirm, routeUnsubscribe:
+ assets.NoIndex = true
s.serveSubscription(c, e, rt.kind, host, slug, base, assets)
return
}
@@ -339,7 +355,9 @@ func (s *Server) serve(c *gin.Context) {
assets.Query = q
}
assets.OnlyProblems = c.Query("problems") == "1"
- web.Render(c, http.StatusOK, web.PublicStatusPage(e.Snap.WithMaintenance(s.now()), assets))
+ snap := e.Snap.WithMaintenance(s.now())
+ assets.Meta = s.pageMeta(c, snap, base)
+ web.Render(c, http.StatusOK, web.PublicStatusPage(snap, assets))
}
// componentsPerPage is how many of its own components a section of a
@@ -403,14 +421,17 @@ func (s *Server) serveLegal(c *gin.Context, e entry, kind, base string) {
}
s.localizeRequest(c)
c.Header("Cache-Control", "public, max-age=300")
- web.Render(c, http.StatusOK, web.PublicLegalPage(e.Snap, web.PublicAssets{CSSHref: "/static/dist/app.css"}, kind, html, base))
+ web.Render(c, http.StatusOK, web.PublicLegalPage(e.Snap, web.PublicAssets{CSSHref: "/static/dist/app.css", NoIndex: true}, kind, html, base))
}
}
+// localizeRequest shows the language ?lang= names, else the visitor's
+// preferred one; each language has its own address for search engines.
func (s *Server) localizeRequest(c *gin.Context) {
- l := s.catalog.Match(c.GetHeader("Accept-Language"))
+ l := s.catalog.Match(c.Query("lang"), c.GetHeader("Accept-Language"))
c.Request = c.Request.WithContext(i18n.NewContext(c.Request.Context(), l))
c.Header("Content-Language", l.Lang())
+ c.Writer.Header().Add("Vary", "Accept-Language")
}
// lookup answers from the cache whenever possible and refreshes in the
diff --git a/internal/statuspage/statuspage_test.go b/internal/statuspage/statuspage_test.go
index d0ff4ee..4f1e3ea 100644
--- a/internal/statuspage/statuspage_test.go
+++ b/internal/statuspage/statuspage_test.go
@@ -1,6 +1,7 @@
package statuspage
import (
+ "bytes"
"context"
"errors"
"fmt"
@@ -690,3 +691,88 @@ func TestComponentPagingAndSearch(t *testing.T) {
t.Errorf("component page lacks the bar tooltips")
}
}
+
+func (h harness) getFull(host, path string) *httptest.ResponseRecorder {
+ req := httptest.NewRequest(http.MethodGet, path, nil)
+ req.Host = host
+ req.Header.Set("Accept-Language", "de")
+ w := httptest.NewRecorder()
+ h.r.ServeHTTP(w, req)
+ return w
+}
+
+func TestSearchAndPreviewMetadata(t *testing.T) {
+ now := time.Now()
+ src := newSource()
+ src.set(func(f *fakeSource) {
+ p := f.pages["|acme"]
+ p.Description = "Status of **Acme** services.\n\nSecond paragraph."
+ p.ShowDetails = true
+ p.Sections = []agentapi.Section{{Components: []agentapi.Component{{ID: "c1", Name: "API", Status: agentapi.PageOperational}}}}
+ f.pages["|acme"] = p
+ })
+ h := newHarness(t, src, t.TempDir(), &now)
+
+ _, body := h.get("status.example.test", "/acme")
+ for _, want := range []string{
+ ``,
+ ``,
+ ``,
+ ``,
+ ``,
+ ``,
+ ``,
+ ``,
+ } {
+ if !strings.Contains(body, want) {
+ t.Errorf("status page lacks %s", want)
+ }
+ }
+ if strings.Contains(body, "noindex") {
+ t.Errorf("status page is noindex")
+ }
+
+ // ?lang= picks the language and becomes the canonical address.
+ _, body = h.get("status.example.test", "/acme?lang=en&q=api")
+ if !strings.Contains(body, "All systems operational") || !strings.Contains(body, ``) {
+ t.Errorf("?lang=en does not show English with its own canonical address")
+ }
+
+ // A page without a description describes itself by its status.
+ _, body = h.get("status.acme.test", "/")
+ if !strings.Contains(body, ``) {
+ t.Errorf("custom domain canonical address missing")
+ }
+
+ for _, path := range []string{"/acme/components/c1", "/acme/subscribe"} {
+ if code, body := h.get("status.example.test", path); code == 200 && !strings.Contains(body, ``) {
+ t.Errorf("GET %s is indexable", path)
+ }
+ }
+
+ w := h.getFull("status.example.test", "/acme/og.png")
+ if w.Code != 200 || w.Header().Get("Content-Type") != "image/png" || !bytes.HasPrefix(w.Body.Bytes(), []byte("\x89PNG")) {
+ t.Errorf("preview image = %d %s", w.Code, w.Header().Get("Content-Type"))
+ }
+ if code, _ := h.get("status.example.test", "/missing/og.png"); code != 404 {
+ t.Errorf("preview image of a missing page = %d, want 404", code)
+ }
+
+ w = h.getFull("status.acme.test", "/sitemap.xml")
+ sm := w.Body.String()
+ if w.Code != 200 || !strings.Contains(sm, "http://status.acme.test/") || !strings.Contains(sm, `hreflang="de" href="http://status.acme.test/?lang=de"`) {
+ t.Errorf("sitemap = %d %s", w.Code, sm)
+ }
+
+ _, robots := h.get("status.acme.test", "/robots.txt")
+ if !strings.Contains(robots, "Disallow: /api/") || !strings.Contains(robots, "Sitemap: http://status.acme.test/sitemap.xml") {
+ t.Errorf("custom domain robots.txt = %q", robots)
+ }
+ _, robots = h.get("status.example.test", "/robots.txt")
+ if !strings.Contains(robots, "Disallow: /*/api/") || strings.Contains(robots, "Sitemap:") {
+ t.Errorf("shared host robots.txt = %q", robots)
+ }
+}
diff --git a/internal/web/layout.templ b/internal/web/layout.templ
index 8bbf412..a2417ba 100644
--- a/internal/web/layout.templ
+++ b/internal/web/layout.templ
@@ -19,6 +19,9 @@ type Page struct {
Legal []LegalLink
// RefreshSeconds reloads pages that show live state.
RefreshSeconds int
+ // Meta describes public pages for search engines and link previews;
+ // pages without it are kept out of search engines.
+ Meta *PageMeta
}
templ Layout(p Page) {
@@ -34,6 +37,11 @@ templ Layout(p Page) {
}
{ i18n.T(ctx, p.TitleID) } · UptimeSebi
+ if p.Meta != nil {
+ @metaTags(p.Meta)
+ } else {
+ @noIndex()
+ }
@faviconLinks()
diff --git a/internal/web/layout_templ.go b/internal/web/layout_templ.go
index 3f968b6..995cd68 100644
--- a/internal/web/layout_templ.go
+++ b/internal/web/layout_templ.go
@@ -28,6 +28,9 @@ type Page struct {
Legal []LegalLink
// RefreshSeconds reloads pages that show live state.
RefreshSeconds int
+ // Meta describes public pages for search engines and link previews;
+ // pages without it are kept out of search engines.
+ Meta *PageMeta
}
func Layout(p Page) templ.Component {
@@ -55,7 +58,7 @@ func Layout(p Page) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.Lang(ctx)).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 26, Col: 28}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 29, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2)
if templ_7745c5c3_Err != nil {
@@ -73,7 +76,7 @@ func Layout(p Page) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templruntime.NewAttributeExpression(p.CSRF).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 31, Col: 44}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 34, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
if templ_7745c5c3_Err != nil {
@@ -92,7 +95,7 @@ func Layout(p Page) templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templruntime.NewAttributeExpression(strconv.Itoa(p.RefreshSeconds)).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 34, Col: 71}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 37, Col: 71}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4)
if templ_7745c5c3_Err != nil {
@@ -110,7 +113,7 @@ func Layout(p Page) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 36, Col: 34}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 39, Col: 34}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -120,6 +123,17 @@ func Layout(p Page) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+ if p.Meta != nil {
+ templ_7745c5c3_Err = metaTags(p.Meta).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ } else {
+ templ_7745c5c3_Err = noIndex().Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
templ_7745c5c3_Err = faviconLinks().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
@@ -131,7 +145,7 @@ func Layout(p Page) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "app.network_error")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 42, Col: 94}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 50, Col: 94}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
if templ_7745c5c3_Err != nil {
@@ -191,7 +205,7 @@ func languageSwitch(langs []string) templ.Component {
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(l)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 55, Col: 50}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 63, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
@@ -209,7 +223,7 @@ func languageSwitch(langs []string) templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templruntime.NewAttributeExpression(l).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 57, Col: 41}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 65, Col: 41}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var9)
if templ_7745c5c3_Err != nil {
@@ -222,7 +236,7 @@ func languageSwitch(langs []string) templ.Component {
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "lang."+l)).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 57, Col: 108}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 65, Col: 108}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
if templ_7745c5c3_Err != nil {
@@ -235,7 +249,7 @@ func languageSwitch(langs []string) templ.Component {
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(l)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 57, Col: 114}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 65, Col: 114}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@@ -304,7 +318,7 @@ func authShell(p Page) templ.Component {
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.TitleID))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 70, Col: 66}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 78, Col: 66}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
@@ -360,7 +374,7 @@ func field(label, name, typ, autocomplete string, required bool) templ.Component
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 79, Col: 90}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 87, Col: 90}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil {
@@ -373,7 +387,7 @@ func field(label, name, typ, autocomplete string, required bool) templ.Component
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templruntime.NewAttributeExpression(typ).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 82, Col: 13}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 90, Col: 13}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var17)
if templ_7745c5c3_Err != nil {
@@ -386,7 +400,7 @@ func field(label, name, typ, autocomplete string, required bool) templ.Component
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templruntime.NewAttributeExpression(name).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 83, Col: 14}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 91, Col: 14}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var18)
if templ_7745c5c3_Err != nil {
@@ -399,7 +413,7 @@ func field(label, name, typ, autocomplete string, required bool) templ.Component
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templruntime.NewAttributeExpression(autocomplete).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 84, Col: 30}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 92, Col: 30}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19)
if templ_7745c5c3_Err != nil {
@@ -447,7 +461,7 @@ func submit(label string) templ.Component {
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 92, Col: 9}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 100, Col: 9}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
if templ_7745c5c3_Err != nil {
@@ -486,7 +500,7 @@ func flash(p Page) templ.Component {
var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.ErrorID))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 98, Col: 88}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 106, Col: 88}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil {
@@ -505,7 +519,7 @@ func flash(p Page) templ.Component {
var templ_7745c5c3_Var24 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, p.NoticeID))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 101, Col: 77}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/layout.templ`, Line: 109, Col: 77}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
if templ_7745c5c3_Err != nil {
diff --git a/internal/web/meta.templ b/internal/web/meta.templ
new file mode 100644
index 0000000..ce45a70
--- /dev/null
+++ b/internal/web/meta.templ
@@ -0,0 +1,138 @@
+package web
+
+import (
+ "html"
+ "net/url"
+ "regexp"
+ "strconv"
+ "strings"
+ "unicode/utf8"
+
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/ogimage"
+)
+
+// PageMeta describes a page for search engines and link previews. Pages
+// without one are private and carry noindex.
+type PageMeta struct {
+ // Title is the shared title, without the site suffix of .
+ Title string
+ Description string
+ // URL is the canonical address of the page.
+ URL string
+ Image string
+ SiteName string
+ // Lang is the language the page is shown in.
+ Lang string
+ // Alternates are the page in each language, plus x-default.
+ Alternates []MetaAlternate
+}
+
+// MetaAlternate is a language version of a page; Lang "x-default" marks
+// the one that picks the language itself.
+type MetaAlternate struct {
+ Lang string
+ URL string
+}
+
+// LangURL adds ?lang= to a page's address.
+func LangURL(base, lang string) string {
+ u, err := url.Parse(base)
+ if err != nil {
+ return base
+ }
+ q := u.Query()
+ q.Set("lang", lang)
+ u.RawQuery = q.Encode()
+ return u.String()
+}
+
+// NewPageMeta fills the language versions and the canonical address of a
+// page at base: the address of its language when the visitor chose one
+// with ?lang=, else base, which picks the language itself.
+func NewPageMeta(title, description, base, image, siteName, lang string, chosen bool, langs []string) *PageMeta {
+ m := &PageMeta{Title: title, Description: description, URL: base, Image: image, SiteName: siteName, Lang: lang}
+ if chosen {
+ m.URL = LangURL(base, lang)
+ }
+ for _, l := range langs {
+ m.Alternates = append(m.Alternates, MetaAlternate{Lang: l, URL: LangURL(base, l)})
+ }
+ m.Alternates = append(m.Alternates, MetaAlternate{Lang: "x-default", URL: base})
+ return m
+}
+
+var tagRE = regexp.MustCompile(`<[^>]*>`)
+
+// PlainText turns Markdown into a single line of text of at most max
+// characters, for descriptions.
+func PlainText(markdown string, max int) string {
+ s := html.UnescapeString(tagRE.ReplaceAllString(Markdown(markdown), " "))
+ s = strings.Join(strings.Fields(s), " ")
+ if utf8.RuneCountInString(s) <= max {
+ return s
+ }
+ r := []rune(s)[:max-1]
+ if i := strings.LastIndex(string(r), " "); i > max/2 {
+ return string(r)[:i] + "…"
+ }
+ return string(r) + "…"
+}
+
+// ogLocale maps a language to the locale Open Graph expects.
+func ogLocale(lang string) string {
+ switch lang {
+ case "de":
+ return "de_DE"
+ case "en":
+ return "en_US"
+ }
+ return strings.ReplaceAll(lang, "-", "_")
+}
+
+// metaTags are the description, canonical address, language versions and
+// Open Graph and Twitter tags of m.
+templ metaTags(m *PageMeta) {
+ if m.Description != "" {
+
+ }
+
+ for _, a := range m.Alternates {
+
+ }
+
+ if m.SiteName != "" {
+
+ }
+
+ if m.Description != "" {
+
+ }
+
+
+ if m.Image != "" {
+
+
+
+
+
+ }
+
+
+ if m.Description != "" {
+
+ }
+ if m.Image != "" {
+
+ }
+}
+
+func twitterCard(m *PageMeta) string {
+ if m.Image != "" {
+ return "summary_large_image"
+ }
+ return "summary"
+}
+
+templ noIndex() {
+
+}
diff --git a/internal/web/meta_templ.go b/internal/web/meta_templ.go
new file mode 100644
index 0000000..d4ed154
--- /dev/null
+++ b/internal/web/meta_templ.go
@@ -0,0 +1,439 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: v0.3.1118
+
+package web
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import templruntime "github.com/a-h/templ/runtime"
+
+import (
+ "html"
+ "net/url"
+ "regexp"
+ "strconv"
+ "strings"
+ "unicode/utf8"
+
+ "git.zb-server.de/ZB-Server/uptimesebi/internal/ogimage"
+)
+
+// PageMeta describes a page for search engines and link previews. Pages
+// without one are private and carry noindex.
+type PageMeta struct {
+ // Title is the shared title, without the site suffix of .
+ Title string
+ Description string
+ // URL is the canonical address of the page.
+ URL string
+ Image string
+ SiteName string
+ // Lang is the language the page is shown in.
+ Lang string
+ // Alternates are the page in each language, plus x-default.
+ Alternates []MetaAlternate
+}
+
+// MetaAlternate is a language version of a page; Lang "x-default" marks
+// the one that picks the language itself.
+type MetaAlternate struct {
+ Lang string
+ URL string
+}
+
+// LangURL adds ?lang= to a page's address.
+func LangURL(base, lang string) string {
+ u, err := url.Parse(base)
+ if err != nil {
+ return base
+ }
+ q := u.Query()
+ q.Set("lang", lang)
+ u.RawQuery = q.Encode()
+ return u.String()
+}
+
+// NewPageMeta fills the language versions and the canonical address of a
+// page at base: the address of its language when the visitor chose one
+// with ?lang=, else base, which picks the language itself.
+func NewPageMeta(title, description, base, image, siteName, lang string, chosen bool, langs []string) *PageMeta {
+ m := &PageMeta{Title: title, Description: description, URL: base, Image: image, SiteName: siteName, Lang: lang}
+ if chosen {
+ m.URL = LangURL(base, lang)
+ }
+ for _, l := range langs {
+ m.Alternates = append(m.Alternates, MetaAlternate{Lang: l, URL: LangURL(base, l)})
+ }
+ m.Alternates = append(m.Alternates, MetaAlternate{Lang: "x-default", URL: base})
+ return m
+}
+
+var tagRE = regexp.MustCompile(`<[^>]*>`)
+
+// PlainText turns Markdown into a single line of text of at most max
+// characters, for descriptions.
+func PlainText(markdown string, max int) string {
+ s := html.UnescapeString(tagRE.ReplaceAllString(Markdown(markdown), " "))
+ s = strings.Join(strings.Fields(s), " ")
+ if utf8.RuneCountInString(s) <= max {
+ return s
+ }
+ r := []rune(s)[:max-1]
+ if i := strings.LastIndex(string(r), " "); i > max/2 {
+ return string(r)[:i] + "…"
+ }
+ return string(r) + "…"
+}
+
+// ogLocale maps a language to the locale Open Graph expects.
+func ogLocale(lang string) string {
+ switch lang {
+ case "de":
+ return "de_DE"
+ case "en":
+ return "en_US"
+ }
+ return strings.ReplaceAll(lang, "-", "_")
+}
+
+// metaTags are the description, canonical address, language versions and
+// Open Graph and Twitter tags of m.
+func metaTags(m *PageMeta) templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ if m.Description != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ for _, a := range m.Alternates {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if m.SiteName != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if m.Description != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if m.Image != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if m.Description != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ if m.Image != "" {
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ return nil
+ })
+}
+
+func twitterCard(m *PageMeta) string {
+ if m.Image != "" {
+ return "summary_large_image"
+ }
+ return "summary"
+}
+
+func noIndex() templ.Component {
+ return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
+ if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+ return templ_7745c5c3_CtxErr
+ }
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+ if !templ_7745c5c3_IsBuffer {
+ defer func() {
+ templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err == nil {
+ templ_7745c5c3_Err = templ_7745c5c3_BufErr
+ }
+ }()
+ }
+ ctx = templ.InitializeContext(ctx)
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ return nil
+ })
+}
+
+var _ = templruntime.GeneratedTemplate
diff --git a/internal/web/public.go b/internal/web/public.go
index 47f8b2a..0af9297 100644
--- a/internal/web/public.go
+++ b/internal/web/public.go
@@ -16,6 +16,11 @@ import (
type PublicAssets struct {
CSSHref string
InlineCSS string
+ // Meta describes the page for search engines and link previews.
+ Meta *PageMeta
+ // NoIndex keeps the page out of search engines, as with legal and
+ // subscription pages, which only repeat or serve the status page.
+ NoIndex bool
// StaleSince, if set, tells visitors that live updates are unavailable
// and the page shows the state of that moment.
StaleSince time.Time
diff --git a/internal/web/public.templ b/internal/web/public.templ
index 45d9202..bb30cbe 100644
--- a/internal/web/public.templ
+++ b/internal/web/public.templ
@@ -22,6 +22,12 @@ templ publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) {
}
{ docTitle }
+ if a.Meta != nil {
+ @metaTags(a.Meta)
+ }
+ if a.NoIndex {
+ @noIndex()
+ }
if a.InlineCSS == "" {
@faviconLinks()
}
diff --git a/internal/web/public_templ.go b/internal/web/public_templ.go
index dd25a56..43e4869 100644
--- a/internal/web/public_templ.go
+++ b/internal/web/public_templ.go
@@ -108,6 +108,18 @@ func publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) templ
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+ if a.Meta != nil {
+ templ_7745c5c3_Err = metaTags(a.Meta).Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
+ if a.NoIndex {
+ templ_7745c5c3_Err = noIndex().Render(ctx, templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ }
if a.InlineCSS == "" {
templ_7745c5c3_Err = faviconLinks().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
@@ -127,7 +139,7 @@ func publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) templ
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templruntime.NewAttributeExpression(a.CSSHref).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 31, Col: 43}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 37, Col: 43}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
if templ_7745c5c3_Err != nil {
@@ -165,7 +177,7 @@ func publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) templ
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.updated", "Time", s.GeneratedAt.UTC().Format(time.DateTime)+" UTC"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 44, Col: 98}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 50, Col: 98}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@@ -183,7 +195,7 @@ func publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) templ
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(a.ComponentBase + "feed.rss")).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 47, Col: 60}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 53, Col: 60}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var8)
if templ_7745c5c3_Err != nil {
@@ -196,7 +208,7 @@ func publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) templ
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.feed"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 47, Col: 112}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 53, Col: 112}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@@ -209,7 +221,7 @@ func publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) templ
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(a.ComponentBase + "api/v1/summary")).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 48, Col: 66}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 54, Col: 66}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
if templ_7745c5c3_Err != nil {
@@ -222,7 +234,7 @@ func publicShell(s agentapi.PageSnapshot, a PublicAssets, docTitle string) templ
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.api"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 48, Col: 117}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 54, Col: 117}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@@ -280,7 +292,7 @@ func publicStaleNotice(a PublicAssets) templ.Component {
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.stale", "Time", a.StaleSince.UTC().Format("2006-01-02 15:04")+" UTC"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 67, Col: 92}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 73, Col: 92}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
@@ -336,7 +348,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templruntime.NewAttributeExpression(s.Theme.LogoURL).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 76, Col: 30}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 82, Col: 30}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var16)
if templ_7745c5c3_Err != nil {
@@ -349,7 +361,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templruntime.NewAttributeExpression(s.Title).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 76, Col: 46}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 82, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var17)
if templ_7745c5c3_Err != nil {
@@ -367,7 +379,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(s.Title)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 78, Col: 88}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 84, Col: 88}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil {
@@ -447,7 +459,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var21 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.status."+s.Status))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 94, Col: 72}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 100, Col: 72}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21))
if templ_7745c5c3_Err != nil {
@@ -487,7 +499,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var22 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.filter_no_problems"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 107, Col: 81}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 113, Col: 81}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22))
if templ_7745c5c3_Err != nil {
@@ -505,7 +517,7 @@ func PublicStatusPage(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var23 string
templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.search_none"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 109, Col: 74}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 115, Col: 74}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil {
@@ -575,7 +587,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var25 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.subscribe.title"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 125, Col: 112}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 131, Col: 112}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
if templ_7745c5c3_Err != nil {
@@ -588,7 +600,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var26 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.subscribe.intro"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 126, Col: 63}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 132, Col: 63}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26))
if templ_7745c5c3_Err != nil {
@@ -601,7 +613,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var27 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(a.ComponentBase + "subscribe")).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 127, Col: 75}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 133, Col: 75}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var27)
if templ_7745c5c3_Err != nil {
@@ -614,7 +626,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var28 string
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.subscribe.email"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 129, Col: 86}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 135, Col: 86}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
if templ_7745c5c3_Err != nil {
@@ -627,7 +639,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var29 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "page.subscribe.email")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 130, Col: 153}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 136, Col: 153}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var29)
if templ_7745c5c3_Err != nil {
@@ -640,7 +652,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var30 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.subscribe.submit"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 131, Col: 140}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 137, Col: 140}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
if templ_7745c5c3_Err != nil {
@@ -658,7 +670,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var31 string
templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, ConsentLabelID(consent)))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 137, Col: 44}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 143, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
if templ_7745c5c3_Err != nil {
@@ -682,7 +694,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var32 string
templ_7745c5c3_Var32, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(l.Href)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 142, Col: 38}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 148, Col: 38}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var32)
if templ_7745c5c3_Err != nil {
@@ -695,7 +707,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var33 string
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, LegalTitleID(l.Kind)))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 142, Col: 144}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 148, Col: 144}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
if templ_7745c5c3_Err != nil {
@@ -718,7 +730,7 @@ func publicSubscribe(s agentapi.PageSnapshot, a PublicAssets) templ.Component {
var templ_7745c5c3_Var34 string
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.subscribe.privacy"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 148, Col: 76}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 154, Col: 76}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34))
if templ_7745c5c3_Err != nil {
@@ -770,7 +782,7 @@ func PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message st
var templ_7745c5c3_Var37 string
templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(s.Title)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 157, Col: 57}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 163, Col: 57}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
if templ_7745c5c3_Err != nil {
@@ -783,7 +795,7 @@ func PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message st
var templ_7745c5c3_Var38 string
templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 158, Col: 86}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 164, Col: 86}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
if templ_7745c5c3_Err != nil {
@@ -796,7 +808,7 @@ func PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message st
var templ_7745c5c3_Var39 string
templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(message)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 160, Col: 36}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 166, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
if templ_7745c5c3_Err != nil {
@@ -814,7 +826,7 @@ func PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message st
var templ_7745c5c3_Var40 string
templ_7745c5c3_Var40, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(form.Action)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 162, Col: 58}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 168, Col: 58}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var40)
if templ_7745c5c3_Err != nil {
@@ -827,7 +839,7 @@ func PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message st
var templ_7745c5c3_Var41 string
templ_7745c5c3_Var41, templ_7745c5c3_Err = templruntime.NewAttributeExpression(form.Token).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 163, Col: 56}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 169, Col: 56}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var41)
if templ_7745c5c3_Err != nil {
@@ -840,7 +852,7 @@ func PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message st
var templ_7745c5c3_Var42 string
templ_7745c5c3_Var42, templ_7745c5c3_Err = templ.JoinStringErrs(form.Button)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 164, Col: 115}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 170, Col: 115}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var42))
if templ_7745c5c3_Err != nil {
@@ -858,7 +870,7 @@ func PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message st
var templ_7745c5c3_Var43 string
templ_7745c5c3_Var43, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(a.ComponentBase)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 167, Col: 67}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 173, Col: 67}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var43)
if templ_7745c5c3_Err != nil {
@@ -871,7 +883,7 @@ func PublicNoticePage(s agentapi.PageSnapshot, a PublicAssets, title, message st
var templ_7745c5c3_Var44 string
templ_7745c5c3_Var44, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.back"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 167, Col: 133}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 173, Col: 133}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var44))
if templ_7745c5c3_Err != nil {
@@ -917,7 +929,7 @@ func publicComponentFilter(v ComponentView, a PublicAssets) templ.Component {
var templ_7745c5c3_Var46 string
templ_7745c5c3_Var46, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(BackHref(a.ComponentBase))).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 174, Col: 69}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 180, Col: 69}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var46)
if templ_7745c5c3_Err != nil {
@@ -930,7 +942,7 @@ func publicComponentFilter(v ComponentView, a PublicAssets) templ.Component {
var templ_7745c5c3_Var47 string
templ_7745c5c3_Var47, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.search"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 175, Col: 76}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 181, Col: 76}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var47))
if templ_7745c5c3_Err != nil {
@@ -943,7 +955,7 @@ func publicComponentFilter(v ComponentView, a PublicAssets) templ.Component {
var templ_7745c5c3_Var48 string
templ_7745c5c3_Var48, templ_7745c5c3_Err = templruntime.NewAttributeExpression(v.Query).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 176, Col: 69}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 182, Col: 69}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var48)
if templ_7745c5c3_Err != nil {
@@ -956,7 +968,7 @@ func publicComponentFilter(v ComponentView, a PublicAssets) templ.Component {
var templ_7745c5c3_Var49 string
templ_7745c5c3_Var49, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "page.search")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 176, Col: 128}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 182, Col: 128}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var49)
if templ_7745c5c3_Err != nil {
@@ -979,7 +991,7 @@ func publicComponentFilter(v ComponentView, a PublicAssets) templ.Component {
var templ_7745c5c3_Var50 string
templ_7745c5c3_Var50, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.filter_problems", "Count", v.Problems))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 179, Col: 67}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 185, Col: 67}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var50))
if templ_7745c5c3_Err != nil {
@@ -992,7 +1004,7 @@ func publicComponentFilter(v ComponentView, a PublicAssets) templ.Component {
var templ_7745c5c3_Var51 string
templ_7745c5c3_Var51, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.search_submit"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 181, Col: 127}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 187, Col: 127}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var51))
if templ_7745c5c3_Err != nil {
@@ -1010,7 +1022,7 @@ func publicComponentFilter(v ComponentView, a PublicAssets) templ.Component {
var templ_7745c5c3_Var52 string
templ_7745c5c3_Var52, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(v.ResetHref())).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 183, Col: 41}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 189, Col: 41}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var52)
if templ_7745c5c3_Err != nil {
@@ -1023,7 +1035,7 @@ func publicComponentFilter(v ComponentView, a PublicAssets) templ.Component {
var templ_7745c5c3_Var53 string
templ_7745c5c3_Var53, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.search_clear"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 183, Col: 112}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 189, Col: 112}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var53))
if templ_7745c5c3_Err != nil {
@@ -1068,7 +1080,7 @@ func publicSectionPager(sec PublicSection, v ComponentView) templ.Component {
var templ_7745c5c3_Var55 string
templ_7745c5c3_Var55, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.T(ctx, "pager.label")).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 191, Col: 132}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 197, Col: 132}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var55)
if templ_7745c5c3_Err != nil {
@@ -1086,7 +1098,7 @@ func publicSectionPager(sec PublicSection, v ComponentView) templ.Component {
var templ_7745c5c3_Var56 string
templ_7745c5c3_Var56, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(v.PageHref(sec.Key, sec.Page-1))).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 193, Col: 60}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 199, Col: 60}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var56)
if templ_7745c5c3_Err != nil {
@@ -1099,7 +1111,7 @@ func publicSectionPager(sec PublicSection, v ComponentView) templ.Component {
var templ_7745c5c3_Var57 string
templ_7745c5c3_Var57, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pager.previous"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 193, Col: 143}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 199, Col: 143}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var57))
if templ_7745c5c3_Err != nil {
@@ -1117,7 +1129,7 @@ func publicSectionPager(sec PublicSection, v ComponentView) templ.Component {
var templ_7745c5c3_Var58 string
templ_7745c5c3_Var58, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.pages", "Page", sec.Page+1, "Pages", sec.Pages))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 195, Col: 113}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 201, Col: 113}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var58))
if templ_7745c5c3_Err != nil {
@@ -1135,7 +1147,7 @@ func publicSectionPager(sec PublicSection, v ComponentView) templ.Component {
var templ_7745c5c3_Var59 string
templ_7745c5c3_Var59, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(v.PageHref(sec.Key, sec.Page+1))).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 197, Col: 60}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 203, Col: 60}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var59)
if templ_7745c5c3_Err != nil {
@@ -1148,7 +1160,7 @@ func publicSectionPager(sec PublicSection, v ComponentView) templ.Component {
var templ_7745c5c3_Var60 string
templ_7745c5c3_Var60, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "pager.next"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 197, Col: 143}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 203, Col: 143}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var60))
if templ_7745c5c3_Err != nil {
@@ -1195,7 +1207,7 @@ func publicSection(sec PublicSection, v ComponentView, s agentapi.PageSnapshot,
var templ_7745c5c3_Var62 string
templ_7745c5c3_Var62, templ_7745c5c3_Err = templruntime.NewAttributeExpression("g-" + sec.Key).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 207, Col: 26}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 213, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var62)
if templ_7745c5c3_Err != nil {
@@ -1225,7 +1237,7 @@ func publicSection(sec PublicSection, v ComponentView, s agentapi.PageSnapshot,
var templ_7745c5c3_Var63 string
templ_7745c5c3_Var63, templ_7745c5c3_Err = templruntime.NewAttributeExpression("g-" + sec.Key).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 212, Col: 35}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 218, Col: 35}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var63)
if templ_7745c5c3_Err != nil {
@@ -1246,7 +1258,7 @@ func publicSection(sec PublicSection, v ComponentView, s agentapi.PageSnapshot,
var templ_7745c5c3_Var64 string
templ_7745c5c3_Var64, templ_7745c5c3_Err = templ.JoinStringErrs(sec.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 215, Col: 20}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 221, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var64))
if templ_7745c5c3_Err != nil {
@@ -1259,7 +1271,7 @@ func publicSection(sec PublicSection, v ComponentView, s agentapi.PageSnapshot,
var templ_7745c5c3_Var65 string
templ_7745c5c3_Var65, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(sec.Total))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 216, Col: 84}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 222, Col: 84}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var65))
if templ_7745c5c3_Err != nil {
@@ -1272,7 +1284,7 @@ func publicSection(sec PublicSection, v ComponentView, s agentapi.PageSnapshot,
var templ_7745c5c3_Var66 string
templ_7745c5c3_Var66, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+sec.Status))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 217, Col: 100}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 223, Col: 100}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var66))
if templ_7745c5c3_Err != nil {
@@ -1351,7 +1363,7 @@ func publicComponentList(comps []agentapi.Component, s agentapi.PageSnapshot, a
var templ_7745c5c3_Var68 string
templ_7745c5c3_Var68, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(href)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 247, Col: 35}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 253, Col: 35}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var68)
if templ_7745c5c3_Err != nil {
@@ -1382,7 +1394,7 @@ func publicComponentList(comps []agentapi.Component, s agentapi.PageSnapshot, a
var templ_7745c5c3_Var69 string
templ_7745c5c3_Var69, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.details_expand"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 254, Col: 102}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 260, Col: 102}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var69))
if templ_7745c5c3_Err != nil {
@@ -1490,7 +1502,7 @@ func publicComponentBody(comp agentapi.Component, s agentapi.PageSnapshot, click
var templ_7745c5c3_Var73 string
templ_7745c5c3_Var73, templ_7745c5c3_Err = templ.JoinStringErrs(comp.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 273, Col: 87}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 279, Col: 87}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var73))
if templ_7745c5c3_Err != nil {
@@ -1521,7 +1533,7 @@ func publicComponentBody(comp agentapi.Component, s agentapi.PageSnapshot, click
var templ_7745c5c3_Var74 string
templ_7745c5c3_Var74, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+comp.Status))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 281, Col: 53}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 287, Col: 53}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var74))
if templ_7745c5c3_Err != nil {
@@ -1563,7 +1575,7 @@ func publicComponentBody(comp agentapi.Component, s agentapi.PageSnapshot, click
var templ_7745c5c3_Var75 string
templ_7745c5c3_Var75, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.days_ago", "Count", len(comp.Days)))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 294, Col: 63}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 300, Col: 63}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var75))
if templ_7745c5c3_Err != nil {
@@ -1576,7 +1588,7 @@ func publicComponentBody(comp agentapi.Component, s agentapi.PageSnapshot, click
var templ_7745c5c3_Var76 string
templ_7745c5c3_Var76, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Uptime))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 295, Col: 33}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 301, Col: 33}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var76))
if templ_7745c5c3_Err != nil {
@@ -1589,7 +1601,7 @@ func publicComponentBody(comp agentapi.Component, s agentapi.PageSnapshot, click
var templ_7745c5c3_Var77 string
templ_7745c5c3_Var77, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.today"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 296, Col: 35}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 302, Col: 35}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var77))
if templ_7745c5c3_Err != nil {
@@ -1639,7 +1651,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var80 string
templ_7745c5c3_Var80, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(BackHref(a.ComponentBase))).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 303, Col: 53}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 309, Col: 53}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var80)
if templ_7745c5c3_Err != nil {
@@ -1652,7 +1664,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var81 string
templ_7745c5c3_Var81, templ_7745c5c3_Err = templ.JoinStringErrs(s.Title)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 303, Col: 103}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 309, Col: 103}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var81))
if templ_7745c5c3_Err != nil {
@@ -1673,7 +1685,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var82 string
templ_7745c5c3_Var82, templ_7745c5c3_Err = templ.JoinStringErrs(comp.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 308, Col: 21}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 314, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var82))
if templ_7745c5c3_Err != nil {
@@ -1735,7 +1747,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var85 string
templ_7745c5c3_Var85, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+comp.Status))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 320, Col: 80}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 326, Col: 80}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var85))
if templ_7745c5c3_Err != nil {
@@ -1758,7 +1770,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var86 string
templ_7745c5c3_Var86, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.details_last_24h"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 327, Col: 111}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 333, Col: 111}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var86))
if templ_7745c5c3_Err != nil {
@@ -1771,7 +1783,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var87 string
templ_7745c5c3_Var87, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Details.SLA24h))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 328, Col: 70}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 334, Col: 70}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var87))
if templ_7745c5c3_Err != nil {
@@ -1794,7 +1806,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var88 string
templ_7745c5c3_Var88, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.latency"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 334, Col: 45}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 340, Col: 45}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var88))
if templ_7745c5c3_Err != nil {
@@ -1807,7 +1819,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var89 string
templ_7745c5c3_Var89, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.details_latency_summary", "Avg", AvgLatencyText(comp.Details.Hours), "Max", strconv.Itoa(lat.MaxMS)+" ms"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 335, Col: 138}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 341, Col: 138}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var89))
if templ_7745c5c3_Err != nil {
@@ -1820,7 +1832,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var90 string
templ_7745c5c3_Var90, templ_7745c5c3_Err = templruntime.NewAttributeExpression("0 0 " + strconv.Itoa(lat.Width) + " " + strconv.Itoa(lat.Height)).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 337, Col: 85}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 343, Col: 85}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var90)
if templ_7745c5c3_Err != nil {
@@ -1833,7 +1845,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var91 string
templ_7745c5c3_Var91, templ_7745c5c3_Err = templruntime.NewAttributeExpression(lat.Points).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 338, Col: 35}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 344, Col: 35}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var91)
if templ_7745c5c3_Err != nil {
@@ -1851,7 +1863,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var92 string
templ_7745c5c3_Var92, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.sla_table"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 343, Col: 112}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 349, Col: 112}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var92))
if templ_7745c5c3_Err != nil {
@@ -1877,7 +1889,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var93 string
templ_7745c5c3_Var93, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.regions"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 348, Col: 111}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 354, Col: 111}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var93))
if templ_7745c5c3_Err != nil {
@@ -1904,7 +1916,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var94 string
templ_7745c5c3_Var94, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "monitors.last_90d"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 355, Col: 106}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 361, Col: 106}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var94))
if templ_7745c5c3_Err != nil {
@@ -1917,7 +1929,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var95 string
templ_7745c5c3_Var95, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Uptime))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 356, Col: 61}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 362, Col: 61}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var95))
if templ_7745c5c3_Err != nil {
@@ -1938,7 +1950,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var96 string
templ_7745c5c3_Var96, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.days_ago", "Count", len(comp.Days)))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 360, Col: 65}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 366, Col: 65}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var96))
if templ_7745c5c3_Err != nil {
@@ -1951,7 +1963,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var97 string
templ_7745c5c3_Var97, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(comp.Uptime))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 361, Col: 35}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 367, Col: 35}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var97))
if templ_7745c5c3_Err != nil {
@@ -1964,7 +1976,7 @@ func PublicComponentPage(s agentapi.PageSnapshot, comp agentapi.Component, a Pub
var templ_7745c5c3_Var98 string
templ_7745c5c3_Var98, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.today"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 362, Col: 37}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 368, Col: 37}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var98))
if templ_7745c5c3_Err != nil {
@@ -2029,7 +2041,7 @@ func publicSLAGrid(d *agentapi.ComponentDetails) templ.Component {
var templ_7745c5c3_Var100 string
templ_7745c5c3_Var100, templ_7745c5c3_Err = templ.JoinStringErrs(item.label)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 382, Col: 57}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 388, Col: 57}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var100))
if templ_7745c5c3_Err != nil {
@@ -2042,7 +2054,7 @@ func publicSLAGrid(d *agentapi.ComponentDetails) templ.Component {
var templ_7745c5c3_Var101 string
templ_7745c5c3_Var101, templ_7745c5c3_Err = templ.JoinStringErrs(UptimeText(item.value))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 383, Col: 58}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 389, Col: 58}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var101))
if templ_7745c5c3_Err != nil {
@@ -2098,7 +2110,7 @@ func publicRegionsList(regions []agentapi.ComponentRegion) templ.Component {
var templ_7745c5c3_Var103 string
templ_7745c5c3_Var103, templ_7745c5c3_Err = templ.JoinStringErrs(r.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 394, Col: 18}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 400, Col: 18}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var103))
if templ_7745c5c3_Err != nil {
@@ -2111,7 +2123,7 @@ func publicRegionsList(regions []agentapi.ComponentRegion) templ.Component {
var templ_7745c5c3_Var104 string
templ_7745c5c3_Var104, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.component."+r.Status))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 396, Col: 46}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 402, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var104))
if templ_7745c5c3_Err != nil {
@@ -2125,7 +2137,7 @@ func publicRegionsList(regions []agentapi.ComponentRegion) templ.Component {
var templ_7745c5c3_Var105 string
templ_7745c5c3_Var105, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + strconv.Itoa(r.LatencyMS) + " ms")
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 398, Col: 50}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 404, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var105))
if templ_7745c5c3_Err != nil {
@@ -2169,7 +2181,7 @@ func publicIncidents(incidents []agentapi.PageIncident) templ.Component {
var templ_7745c5c3_Var107 string
templ_7745c5c3_Var107, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.incidents"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 408, Col: 106}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 414, Col: 106}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var107))
if templ_7745c5c3_Err != nil {
@@ -2187,7 +2199,7 @@ func publicIncidents(incidents []agentapi.PageIncident) templ.Component {
var templ_7745c5c3_Var108 string
templ_7745c5c3_Var108, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.no_incidents"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 410, Col: 67}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 416, Col: 67}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var108))
if templ_7745c5c3_Err != nil {
@@ -2219,7 +2231,7 @@ func publicIncidents(incidents []agentapi.PageIncident) templ.Component {
var templ_7745c5c3_Var109 string
templ_7745c5c3_Var109, templ_7745c5c3_Err = templ.JoinStringErrs(inc.Title)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 418, Col: 45}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 424, Col: 45}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var109))
if templ_7745c5c3_Err != nil {
@@ -2232,7 +2244,7 @@ func publicIncidents(incidents []agentapi.PageIncident) templ.Component {
var templ_7745c5c3_Var110 string
templ_7745c5c3_Var110, templ_7745c5c3_Err = templ.JoinStringErrs(inc.Component)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 419, Col: 56}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 425, Col: 56}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var110))
if templ_7745c5c3_Err != nil {
@@ -2250,7 +2262,7 @@ func publicIncidents(incidents []agentapi.PageIncident) templ.Component {
var templ_7745c5c3_Var111 string
templ_7745c5c3_Var111, templ_7745c5c3_Err = templ.JoinStringErrs(inc.Component)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 421, Col: 29}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 427, Col: 29}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var111))
if templ_7745c5c3_Err != nil {
@@ -2268,7 +2280,7 @@ func publicIncidents(incidents []agentapi.PageIncident) templ.Component {
var templ_7745c5c3_Var112 string
templ_7745c5c3_Var112, templ_7745c5c3_Err = templ.JoinStringErrs(inc.StartedAt.UTC().Format("2006-01-02 15:04"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 424, Col: 56}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 430, Col: 56}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var112))
if templ_7745c5c3_Err != nil {
@@ -2286,7 +2298,7 @@ func publicIncidents(incidents []agentapi.PageIncident) templ.Component {
var templ_7745c5c3_Var113 string
templ_7745c5c3_Var113, templ_7745c5c3_Err = templ.JoinStringErrs(inc.ResolvedAt.UTC().Format("15:04"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 426, Col: 51}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 432, Col: 51}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var113))
if templ_7745c5c3_Err != nil {
@@ -2322,7 +2334,7 @@ func publicIncidents(incidents []agentapi.PageIncident) templ.Component {
var templ_7745c5c3_Var114 string
templ_7745c5c3_Var114, templ_7745c5c3_Err = templ.JoinStringErrs(" · " + u.At.UTC().Format("2006-01-02 15:04") + " UTC")
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 437, Col: 103}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 443, Col: 103}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var114))
if templ_7745c5c3_Err != nil {
@@ -2393,7 +2405,7 @@ func incidentStatusLabel(st IncidentStatusInfo, open bool) templ.Component {
var templ_7745c5c3_Var116 string
templ_7745c5c3_Var116, templ_7745c5c3_Err = templruntime.SanitizeStyleAttributeValues("background-color:" + st.Color)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 460, Col: 89}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 466, Col: 89}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var116))
if templ_7745c5c3_Err != nil {
@@ -2406,7 +2418,7 @@ func incidentStatusLabel(st IncidentStatusInfo, open bool) templ.Component {
var templ_7745c5c3_Var117 string
templ_7745c5c3_Var117, templ_7745c5c3_Err = templ.JoinStringErrs(st.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 461, Col: 13}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 467, Col: 13}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var117))
if templ_7745c5c3_Err != nil {
@@ -2460,7 +2472,7 @@ func incidentStatusLabel(st IncidentStatusInfo, open bool) templ.Component {
var templ_7745c5c3_Var120 string
templ_7745c5c3_Var120, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incident.status."+st.Key))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 464, Col: 102}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 470, Col: 102}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var120))
if templ_7745c5c3_Err != nil {
@@ -2478,7 +2490,7 @@ func incidentStatusLabel(st IncidentStatusInfo, open bool) templ.Component {
var templ_7745c5c3_Var121 string
templ_7745c5c3_Var121, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.ongoing"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 466, Col: 73}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 472, Col: 73}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var121))
if templ_7745c5c3_Err != nil {
@@ -2496,7 +2508,7 @@ func incidentStatusLabel(st IncidentStatusInfo, open bool) templ.Component {
var templ_7745c5c3_Var122 string
templ_7745c5c3_Var122, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "incidents.resolved"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 468, Col: 60}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 474, Col: 60}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var122))
if templ_7745c5c3_Err != nil {
@@ -2536,7 +2548,7 @@ func pageMaintenance(heading string, items []agentapi.PageMaintenance) templ.Com
var templ_7745c5c3_Var124 string
templ_7745c5c3_Var124, templ_7745c5c3_Err = templ.JoinStringErrs(heading)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 475, Col: 85}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 481, Col: 85}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var124))
if templ_7745c5c3_Err != nil {
@@ -2562,7 +2574,7 @@ func pageMaintenance(heading string, items []agentapi.PageMaintenance) templ.Com
var templ_7745c5c3_Var125 string
templ_7745c5c3_Var125, templ_7745c5c3_Err = templ.JoinStringErrs(m.Title)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 482, Col: 17}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 488, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var125))
if templ_7745c5c3_Err != nil {
@@ -2575,7 +2587,7 @@ func pageMaintenance(heading string, items []agentapi.PageMaintenance) templ.Com
var templ_7745c5c3_Var126 string
templ_7745c5c3_Var126, templ_7745c5c3_Err = templ.JoinStringErrs(m.Start.UTC().Format("2006-01-02 15:04") + " – " + m.End.UTC().Format("15:04") + " UTC")
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 485, Col: 99}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 491, Col: 99}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var126))
if templ_7745c5c3_Err != nil {
@@ -2588,7 +2600,7 @@ func pageMaintenance(heading string, items []agentapi.PageMaintenance) templ.Com
var templ_7745c5c3_Var127 string
templ_7745c5c3_Var127, templ_7745c5c3_Err = templ.JoinStringErrs(strings.Join(m.Components, ", "))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 488, Col: 80}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 494, Col: 80}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var127))
if templ_7745c5c3_Err != nil {
@@ -2652,7 +2664,7 @@ func PublicNotFoundPage(cssHref, home string) templ.Component {
var templ_7745c5c3_Var129 string
templ_7745c5c3_Var129, templ_7745c5c3_Err = templruntime.NewAttributeExpression(i18n.Lang(ctx)).Resolve(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 505, Col: 28}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 511, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var129)
if templ_7745c5c3_Err != nil {
@@ -2665,7 +2677,7 @@ func PublicNotFoundPage(cssHref, home string) templ.Component {
var templ_7745c5c3_Var130 string
templ_7745c5c3_Var130, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.not_found_title"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 510, Col: 47}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 516, Col: 47}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var130))
if templ_7745c5c3_Err != nil {
@@ -2686,7 +2698,7 @@ func PublicNotFoundPage(cssHref, home string) templ.Component {
var templ_7745c5c3_Var131 string
templ_7745c5c3_Var131, templ_7745c5c3_Err = templruntime.NewAttributeExpression(cssHref).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 512, Col: 40}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 518, Col: 40}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var131)
if templ_7745c5c3_Err != nil {
@@ -2699,7 +2711,7 @@ func PublicNotFoundPage(cssHref, home string) templ.Component {
var templ_7745c5c3_Var132 string
templ_7745c5c3_Var132, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.not_found_title"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 517, Col: 81}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 523, Col: 81}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var132))
if templ_7745c5c3_Err != nil {
@@ -2712,7 +2724,7 @@ func PublicNotFoundPage(cssHref, home string) templ.Component {
var templ_7745c5c3_Var133 string
templ_7745c5c3_Var133, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.not_found"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 518, Col: 62}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 524, Col: 62}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var133))
if templ_7745c5c3_Err != nil {
@@ -2730,7 +2742,7 @@ func PublicNotFoundPage(cssHref, home string) templ.Component {
var templ_7745c5c3_Var134 string
templ_7745c5c3_Var134, templ_7745c5c3_Err = templruntime.NewAttributeExpression(templ.SafeURL(home)).ResolveURL(ctx)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 521, Col: 35}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 527, Col: 35}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var134)
if templ_7745c5c3_Err != nil {
@@ -2743,7 +2755,7 @@ func PublicNotFoundPage(cssHref, home string) templ.Component {
var templ_7745c5c3_Var135 string
templ_7745c5c3_Var135, templ_7745c5c3_Err = templ.JoinStringErrs(i18n.T(ctx, "page.not_found_home"))
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 521, Col: 161}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/public.templ`, Line: 527, Col: 161}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var135))
if templ_7745c5c3_Err != nil {
diff --git a/internal/web/sitemap.go b/internal/web/sitemap.go
new file mode 100644
index 0000000..615afda
--- /dev/null
+++ b/internal/web/sitemap.go
@@ -0,0 +1,55 @@
+package web
+
+import (
+ "bytes"
+ "encoding/xml"
+ "time"
+)
+
+type sitemapLink struct {
+ Rel string `xml:"rel,attr"`
+ Hreflang string `xml:"hreflang,attr"`
+ Href string `xml:"href,attr"`
+}
+
+type sitemapURL struct {
+ Loc string `xml:"loc"`
+ LastMod string `xml:"lastmod,omitempty"`
+ Links []sitemapLink `xml:"xhtml:link"`
+}
+
+type sitemap struct {
+ XMLName xml.Name `xml:"urlset"`
+ NS string `xml:"xmlns,attr"`
+ XHTML string `xml:"xmlns:xhtml,attr"`
+ URLs []sitemapURL `xml:"url"`
+}
+
+// Sitemap lists pages with each of their language versions, as NewPageMeta
+// names them; lastMod may be zero.
+func Sitemap(pages, langs []string, lastMod time.Time) ([]byte, error) {
+ sm := sitemap{NS: "http://www.sitemaps.org/schemas/sitemap/0.9", XHTML: "http://www.w3.org/1999/xhtml"}
+ mod := ""
+ if !lastMod.IsZero() {
+ mod = lastMod.UTC().Format(time.RFC3339)
+ }
+ for _, page := range pages {
+ m := NewPageMeta("", "", page, "", "", "", false, langs)
+ links := make([]sitemapLink, len(m.Alternates))
+ for i, a := range m.Alternates {
+ links[i] = sitemapLink{Rel: "alternate", Hreflang: a.Lang, Href: a.URL}
+ }
+ for _, a := range m.Alternates {
+ sm.URLs = append(sm.URLs, sitemapURL{Loc: a.URL, LastMod: mod, Links: links})
+ }
+ }
+ var buf bytes.Buffer
+ buf.WriteString(xml.Header)
+ enc := xml.NewEncoder(&buf)
+ enc.Indent("", " ")
+ if err := enc.Encode(sm); err != nil {
+ return nil, err
+ }
+ buf.WriteString("\n")
+ return buf.Bytes(), nil
+}