ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 6m23s
ci / test (pull_request) Successful in 12m44s
ci / build (pull_request) Successful in 16m9s
ci / image (pull_request) Successful in 3m24s
Status pages describe themselves to search engines and link previews: description (from the page's text, else its status), canonical address, language versions via ?lang= with hreflang and x-default, Open Graph and Twitter tags, and a 1200x630 preview image per page and language showing its name and current status (/og.png). Each page has a sitemap.xml, and robots.txt keeps crawlers off feeds, the API and subscription forms. Component, legal and subscription pages are noindex. In the cloud edition the app's sign-in, sign-up and legal pages get the same tags with a preview image of their own, plus robots.txt and a sitemap. Everything signed in stays noindex, and self-hosted installations keep the whole app out of search engines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
116 lines
3.2 KiB
Templ
116 lines
3.2 KiB
Templ
package web
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
|
)
|
|
|
|
// Page carries what every rendered page needs besides its own content.
|
|
type Page struct {
|
|
TitleID string
|
|
CSRF string
|
|
Languages []string
|
|
// ErrorID and NoticeID name catalog messages shown above the content,
|
|
// typically after a redirect back from an SSO flow.
|
|
ErrorID string
|
|
NoticeID string
|
|
// Legal links the platform's legal notice and privacy policy.
|
|
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) {
|
|
<!DOCTYPE html>
|
|
<html lang={ i18n.Lang(ctx) }>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
if p.CSRF != "" {
|
|
<meta name="csrf-token" content={ p.CSRF }/>
|
|
}
|
|
if p.RefreshSeconds > 0 {
|
|
<meta http-equiv="refresh" content={ strconv.Itoa(p.RefreshSeconds) }/>
|
|
}
|
|
<title>{ i18n.T(ctx, p.TitleID) } · UptimeSebi</title>
|
|
if p.Meta != nil {
|
|
@metaTags(p.Meta)
|
|
} else {
|
|
@noIndex()
|
|
}
|
|
@faviconLinks()
|
|
<link rel="stylesheet" href="/static/dist/app.css"/>
|
|
<script src="/static/dist/axios.min.js" defer></script>
|
|
<script src="/static/dist/app.js" defer></script>
|
|
</head>
|
|
<body class="flex min-h-screen flex-col" data-msg-network={ i18n.T(ctx, "app.network_error") }>
|
|
<div class="flex-1">
|
|
{ children... }
|
|
</div>
|
|
@siteFooter(p.Legal)
|
|
</body>
|
|
</html>
|
|
}
|
|
|
|
templ languageSwitch(langs []string) {
|
|
<span class="flex gap-2 font-mono text-xs">
|
|
for _, l := range langs {
|
|
if l == i18n.Lang(ctx) {
|
|
<span class="text-ink" aria-current="true">{ l }</span>
|
|
} else {
|
|
<button type="button" data-locale={ l } class="text-muted hover:text-ink" title={ i18n.T(ctx, "lang."+l) }>{ l }</button>
|
|
}
|
|
}
|
|
</span>
|
|
}
|
|
|
|
templ authShell(p Page) {
|
|
@Layout(p) {
|
|
<main class="mx-auto mt-[12vh] w-full max-w-sm px-6">
|
|
<div class="mb-10 flex items-center justify-between">
|
|
@brandLockup("/")
|
|
@languageSwitch(p.Languages)
|
|
</div>
|
|
<h1 class="mb-6 text-xl font-semibold">{ i18n.T(ctx, p.TitleID) }</h1>
|
|
@flash(p)
|
|
{ children... }
|
|
</main>
|
|
}
|
|
}
|
|
|
|
templ field(label, name, typ, autocomplete string, required bool) {
|
|
<label class="mb-4 block">
|
|
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ label }</span>
|
|
<input
|
|
class="w-full border border-rule bg-transparent px-2.5 py-1.5 outline-none focus:border-ink"
|
|
type={ typ }
|
|
name={ name }
|
|
autocomplete={ autocomplete }
|
|
required?={ required }
|
|
/>
|
|
</label>
|
|
}
|
|
|
|
templ submit(label string) {
|
|
<button type="submit" class="mt-2 w-full bg-ink px-3 py-2 text-sm font-medium text-paper hover:opacity-90 disabled:opacity-50">
|
|
{ label }
|
|
</button>
|
|
}
|
|
|
|
templ flash(p Page) {
|
|
if p.ErrorID != "" {
|
|
<p class="mb-6 border-l-2 border-down pl-2 text-sm text-down">{ i18n.T(ctx, p.ErrorID) }</p>
|
|
}
|
|
if p.NoticeID != "" {
|
|
<p class="mb-6 border-l-2 border-up pl-2 text-sm">{ i18n.T(ctx, p.NoticeID) }</p>
|
|
}
|
|
}
|
|
|
|
templ formError() {
|
|
<p data-error class="mb-4 hidden border-l-2 border-down pl-2 text-sm text-down"></p>
|
|
}
|