2024-10-04 04:39:24 -07:00
|
|
|
package templates
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/chasefleming/elem-go"
|
|
|
|
|
"github.com/chasefleming/elem-go/attrs"
|
|
|
|
|
"github.com/chasefleming/elem-go/styles"
|
2025-11-12 14:23:15 +01:00
|
|
|
"github.com/juanfont/headscale/hscontrol/assets"
|
2024-10-04 04:39:24 -07:00
|
|
|
)
|
|
|
|
|
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
// mdTypesetBody creates a body element with md-typeset styling
|
|
|
|
|
// that matches the official Headscale documentation design.
|
all: apply godoc [Name] link conventions across comments
Every Go-identifier reference in // and /* */ comments now uses
godoc's [Name] linking syntax so pkg.go.dev and `go doc` render
them as clickable cross-references. No behaviour change.
Pattern applied across the tree:
In-package [Foo], [Foo.Bar]
Cross-package [pkg.Foo], [pkg.Foo.Bar]
Stdlib [netip.Prefix], [errors.Is], [context.Context]
Tailscale [tailcfg.MapResponse], [tailcfg.Node.CapMap],
[tailcfg.NodeAttrSuggestExitNode]
Skip rules:
- File:line refs left as plain text
- HuJSON wire keys inside backtick raw strings untouched
- ACL/policy syntax tokens (tag:foo, autogroup:self, ...) not Go
symbols, left as plain text
- JSON/OIDC wire keys, gorm tags, RFC IPv6 placeholders, markdown
link tags, decorative dividers — all left as-is
2026-05-18 18:35:53 +00:00
|
|
|
// Uses CSS classes with styles defined in [assets.CSS].
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
func mdTypesetBody(children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.Body(attrs.Props{
|
|
|
|
|
attrs.Style: styles.Props{
|
|
|
|
|
styles.MinHeight: "100vh",
|
|
|
|
|
styles.Display: "flex",
|
|
|
|
|
styles.FlexDirection: "column",
|
|
|
|
|
styles.AlignItems: "center",
|
2026-04-13 12:38:16 +00:00
|
|
|
styles.BackgroundColor: "var(--hs-bg)",
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
styles.Padding: "3rem 1.5rem",
|
|
|
|
|
}.ToInline(),
|
|
|
|
|
"translate": "no",
|
|
|
|
|
},
|
2026-04-13 12:38:16 +00:00
|
|
|
elem.Main(attrs.Props{
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
attrs.Class: "md-typeset",
|
|
|
|
|
attrs.Style: styles.Props{
|
|
|
|
|
styles.MaxWidth: "min(800px, 90vw)",
|
|
|
|
|
styles.Width: "100%",
|
|
|
|
|
}.ToInline(),
|
|
|
|
|
}, children...),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Styled Element Wrappers
|
|
|
|
|
// These functions wrap elem-go elements using CSS classes.
|
all: apply godoc [Name] link conventions across comments
Every Go-identifier reference in // and /* */ comments now uses
godoc's [Name] linking syntax so pkg.go.dev and `go doc` render
them as clickable cross-references. No behaviour change.
Pattern applied across the tree:
In-package [Foo], [Foo.Bar]
Cross-package [pkg.Foo], [pkg.Foo.Bar]
Stdlib [netip.Prefix], [errors.Is], [context.Context]
Tailscale [tailcfg.MapResponse], [tailcfg.Node.CapMap],
[tailcfg.NodeAttrSuggestExitNode]
Skip rules:
- File:line refs left as plain text
- HuJSON wire keys inside backtick raw strings untouched
- ACL/policy syntax tokens (tag:foo, autogroup:self, ...) not Go
symbols, left as plain text
- JSON/OIDC wire keys, gorm tags, RFC IPv6 placeholders, markdown
link tags, decorative dividers — all left as-is
2026-05-18 18:35:53 +00:00
|
|
|
// Styling is handled by the CSS in [assets.CSS].
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
|
|
|
|
|
// H1 creates a H1 element styled by .md-typeset h1
|
|
|
|
|
func H1(children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.H1(nil, children...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// H2 creates a H2 element styled by .md-typeset h2
|
|
|
|
|
func H2(children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.H2(nil, children...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// H3 creates a H3 element styled by .md-typeset h3
|
|
|
|
|
func H3(children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.H3(nil, children...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// P creates a paragraph element styled by .md-typeset p
|
|
|
|
|
func P(children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.P(nil, children...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Ol creates an ordered list element styled by .md-typeset ol
|
|
|
|
|
func Ol(children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.Ol(nil, children...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Ul creates an unordered list element styled by .md-typeset ul
|
|
|
|
|
func Ul(children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.Ul(nil, children...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// A creates a link element styled by .md-typeset a
|
|
|
|
|
func A(href string, children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.A(attrs.Props{attrs.Href: href}, children...)
|
2024-10-04 04:39:24 -07:00
|
|
|
}
|
|
|
|
|
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
// Code creates an inline code element styled by .md-typeset code
|
|
|
|
|
func Code(children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.Code(nil, children...)
|
2024-10-04 04:39:24 -07:00
|
|
|
}
|
|
|
|
|
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
// Pre creates a preformatted text block styled by .md-typeset pre
|
|
|
|
|
func Pre(children ...elem.Node) *elem.Element {
|
|
|
|
|
return elem.Pre(nil, children...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// PreCode creates a code block inside Pre styled by .md-typeset pre > code
|
|
|
|
|
func PreCode(code string) *elem.Element {
|
|
|
|
|
return elem.Code(nil, elem.Text(code))
|
|
|
|
|
}
|
|
|
|
|
|
all: apply godoc [Name] link conventions across comments
Every Go-identifier reference in // and /* */ comments now uses
godoc's [Name] linking syntax so pkg.go.dev and `go doc` render
them as clickable cross-references. No behaviour change.
Pattern applied across the tree:
In-package [Foo], [Foo.Bar]
Cross-package [pkg.Foo], [pkg.Foo.Bar]
Stdlib [netip.Prefix], [errors.Is], [context.Context]
Tailscale [tailcfg.MapResponse], [tailcfg.Node.CapMap],
[tailcfg.NodeAttrSuggestExitNode]
Skip rules:
- File:line refs left as plain text
- HuJSON wire keys inside backtick raw strings untouched
- ACL/policy syntax tokens (tag:foo, autogroup:self, ...) not Go
symbols, left as plain text
- JSON/OIDC wire keys, gorm tags, RFC IPv6 placeholders, markdown
link tags, decorative dividers — all left as-is
2026-05-18 18:35:53 +00:00
|
|
|
// Deprecated: use [H1], [H2], [H3] instead
|
2024-10-04 04:39:24 -07:00
|
|
|
func headerOne(text string) *elem.Element {
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
return H1(elem.Text(text))
|
2024-10-04 04:39:24 -07:00
|
|
|
}
|
|
|
|
|
|
all: apply godoc [Name] link conventions across comments
Every Go-identifier reference in // and /* */ comments now uses
godoc's [Name] linking syntax so pkg.go.dev and `go doc` render
them as clickable cross-references. No behaviour change.
Pattern applied across the tree:
In-package [Foo], [Foo.Bar]
Cross-package [pkg.Foo], [pkg.Foo.Bar]
Stdlib [netip.Prefix], [errors.Is], [context.Context]
Tailscale [tailcfg.MapResponse], [tailcfg.Node.CapMap],
[tailcfg.NodeAttrSuggestExitNode]
Skip rules:
- File:line refs left as plain text
- HuJSON wire keys inside backtick raw strings untouched
- ACL/policy syntax tokens (tag:foo, autogroup:self, ...) not Go
symbols, left as plain text
- JSON/OIDC wire keys, gorm tags, RFC IPv6 placeholders, markdown
link tags, decorative dividers — all left as-is
2026-05-18 18:35:53 +00:00
|
|
|
// Deprecated: use [H1], [H2], [H3] instead
|
2024-10-04 04:39:24 -07:00
|
|
|
func headerTwo(text string) *elem.Element {
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
return H2(elem.Text(text))
|
2024-10-04 04:39:24 -07:00
|
|
|
}
|
|
|
|
|
|
all: apply godoc [Name] link conventions across comments
Every Go-identifier reference in // and /* */ comments now uses
godoc's [Name] linking syntax so pkg.go.dev and `go doc` render
them as clickable cross-references. No behaviour change.
Pattern applied across the tree:
In-package [Foo], [Foo.Bar]
Cross-package [pkg.Foo], [pkg.Foo.Bar]
Stdlib [netip.Prefix], [errors.Is], [context.Context]
Tailscale [tailcfg.MapResponse], [tailcfg.Node.CapMap],
[tailcfg.NodeAttrSuggestExitNode]
Skip rules:
- File:line refs left as plain text
- HuJSON wire keys inside backtick raw strings untouched
- ACL/policy syntax tokens (tag:foo, autogroup:self, ...) not Go
symbols, left as plain text
- JSON/OIDC wire keys, gorm tags, RFC IPv6 placeholders, markdown
link tags, decorative dividers — all left as-is
2026-05-18 18:35:53 +00:00
|
|
|
// Deprecated: use [H1], [H2], [H3] instead
|
2024-10-04 04:39:24 -07:00
|
|
|
func headerThree(text string) *elem.Element {
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
return H3(elem.Text(text))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// contentContainer wraps page content with proper width.
|
|
|
|
|
// Content inside is left-aligned by default.
|
|
|
|
|
func contentContainer(children ...elem.Node) *elem.Element {
|
|
|
|
|
containerStyle := styles.Props{
|
|
|
|
|
styles.MaxWidth: "720px",
|
|
|
|
|
styles.Width: "100%",
|
|
|
|
|
styles.Display: "flex",
|
|
|
|
|
styles.FlexDirection: "column",
|
|
|
|
|
styles.AlignItems: "flex-start", // Left-align all children
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return elem.Div(attrs.Props{attrs.Style: containerStyle.ToInline()}, children...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// headscaleLogo returns the Headscale SVG logo for consistent branding across all pages.
|
|
|
|
|
// The logo is styled by the .headscale-logo CSS class.
|
|
|
|
|
func headscaleLogo() elem.Node {
|
|
|
|
|
// Return the embedded SVG as-is
|
2025-11-12 14:23:15 +01:00
|
|
|
return elem.Raw(assets.SVG)
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// pageFooter creates a consistent footer for all pages.
|
|
|
|
|
func pageFooter() *elem.Element {
|
2026-04-13 12:42:10 +00:00
|
|
|
return elem.Footer(attrs.Props{
|
|
|
|
|
attrs.Style: styles.Props{
|
|
|
|
|
styles.MarginTop: space3XL,
|
|
|
|
|
styles.TextAlign: "center",
|
|
|
|
|
styles.FontSize: fontSizeSmall,
|
|
|
|
|
styles.Color: "var(--md-default-fg-color--light)",
|
|
|
|
|
styles.LineHeight: lineHeightBase,
|
|
|
|
|
}.ToInline(),
|
|
|
|
|
},
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
elem.Text("Powered by "),
|
|
|
|
|
elem.A(attrs.Props{
|
|
|
|
|
attrs.Href: "https://github.com/juanfont/headscale",
|
|
|
|
|
attrs.Rel: "noreferrer noopener",
|
|
|
|
|
attrs.Target: "_blank",
|
|
|
|
|
}, elem.Text("Headscale")),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// listStyle provides consistent styling for ordered and unordered lists
|
|
|
|
|
// EXTRACTED FROM: .md-typeset ol, .md-typeset ul CSS rules
|
|
|
|
|
var listStyle = styles.Props{
|
|
|
|
|
styles.LineHeight: lineHeightBase, // 1.6 - From .md-typeset
|
|
|
|
|
styles.MarginTop: "1em", // From CSS: margin-top: 1em
|
|
|
|
|
styles.MarginBottom: "1em", // From CSS: margin-bottom: 1em
|
|
|
|
|
styles.PaddingLeft: "clamp(1.5rem, 5vw, 2.5rem)", // Responsive indentation
|
2024-10-04 04:39:24 -07:00
|
|
|
}
|
|
|
|
|
|
2025-10-24 15:43:29 +02:00
|
|
|
// HtmlStructure creates a complete HTML document structure with proper meta tags
|
|
|
|
|
// and semantic HTML5 structure. The head and body elements are passed as parameters
|
|
|
|
|
// to allow for customization of each page.
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
// Styling is provided via a CSS stylesheet (Material for MkDocs design system) with
|
|
|
|
|
// minimal inline styles for layout and positioning.
|
2024-10-04 04:39:24 -07:00
|
|
|
func HtmlStructure(head, body *elem.Element) *elem.Element {
|
2025-10-24 15:43:29 +02:00
|
|
|
return elem.Html(attrs.Props{attrs.Lang: "en"},
|
|
|
|
|
elem.Head(nil,
|
2024-10-04 04:39:24 -07:00
|
|
|
elem.Meta(attrs.Props{
|
|
|
|
|
attrs.Charset: "UTF-8",
|
|
|
|
|
}),
|
|
|
|
|
elem.Meta(attrs.Props{
|
|
|
|
|
attrs.HTTPequiv: "X-UA-Compatible",
|
|
|
|
|
attrs.Content: "IE=edge",
|
|
|
|
|
}),
|
|
|
|
|
elem.Meta(attrs.Props{
|
|
|
|
|
attrs.Name: "viewport",
|
|
|
|
|
attrs.Content: "width=device-width, initial-scale=1.0",
|
|
|
|
|
}),
|
2025-11-11 22:46:57 -05:00
|
|
|
elem.Link(attrs.Props{
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
attrs.Rel: "icon",
|
2025-11-11 22:46:57 -05:00
|
|
|
attrs.Href: "/favicon.ico",
|
|
|
|
|
}),
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
// Google Fonts for Roboto and Roboto Mono
|
|
|
|
|
elem.Link(attrs.Props{
|
2025-11-12 04:54:29 +01:00
|
|
|
attrs.Rel: "preconnect",
|
|
|
|
|
attrs.Href: "https://fonts.gstatic.com",
|
hscontrol/templates: refactor to use CSS classes and embedded files
Refactor template system to use go:embed for external assets and
CSS classes for styling instead of inline styles:
- general.go: Add go:embed directives for style.css and headscale.svg,
replace inline styles with CSS classes (H1, H2, H3, P, etc.),
add mdTypesetBody wrapper with Material for MkDocs styling
- apple.go, oidc_callback.go, register_web.go, windows.go:
Update to use new CSS-based helper functions (H1, H2, P, etc.)
and mdTypesetBody for consistent layout
This separates content from presentation, making templates easier
to maintain and update. All styling is now centralized in style.css
with Material for MkDocs design system.
2025-10-28 16:29:00 +01:00
|
|
|
"crossorigin": "",
|
|
|
|
|
}),
|
|
|
|
|
elem.Link(attrs.Props{
|
|
|
|
|
attrs.Rel: "stylesheet",
|
|
|
|
|
attrs.Href: "https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Roboto+Mono:wght@400;700&display=swap",
|
|
|
|
|
}),
|
|
|
|
|
// Material for MkDocs CSS styles
|
2025-11-12 14:23:15 +01:00
|
|
|
elem.Style(attrs.Props{attrs.Type: "text/css"}, elem.Raw(assets.CSS)),
|
2024-10-04 04:39:24 -07:00
|
|
|
head,
|
|
|
|
|
),
|
|
|
|
|
body,
|
|
|
|
|
)
|
|
|
|
|
}
|
2025-11-12 04:54:29 +01:00
|
|
|
|
|
|
|
|
// BlankPage creates a minimal blank HTML page with favicon.
|
|
|
|
|
// Used for endpoints that need to return a valid HTML page with no content.
|
|
|
|
|
func BlankPage() *elem.Element {
|
|
|
|
|
return elem.Html(attrs.Props{attrs.Lang: "en"},
|
|
|
|
|
elem.Head(nil,
|
|
|
|
|
elem.Meta(attrs.Props{
|
|
|
|
|
attrs.Charset: "UTF-8",
|
|
|
|
|
}),
|
|
|
|
|
elem.Link(attrs.Props{
|
|
|
|
|
attrs.Rel: "icon",
|
|
|
|
|
attrs.Href: "/favicon.ico",
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
elem.Body(nil),
|
|
|
|
|
)
|
|
|
|
|
}
|