Home

ugit @b205fa2103ab82bed4a90513a569effe00420972 - refs - log -
-
https://git.jolheiser.com/ugit.git
The code powering this h*ckin' site
ugit / internal / html / base.go
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package html

import (
	. "maragu.dev/gomponents"
	. "maragu.dev/gomponents/components"
	. "maragu.dev/gomponents/html"
)

type BaseContext struct {
	Title       string
	Description string
}

func base(bc BaseContext, children ...Node) Node {
	return HTML5(HTML5Props{
		Title:       bc.Title,
		Description: bc.Description,
		Head: []Node{
			Link(Rel("icon"), Href("/_/favicon.svg")),
			Link(Rel("stylesheet"), Href("/_/tailwind.css")),
			ogp("title", bc.Title),
			ogp("description", bc.Description),
		},
		Body: []Node{
			Class("latte dark:mocha bg-base/50 dark:bg-base/95 max-w-7xl mx-5 sm:mx-auto my-10"),
			H2(Class("text-text text-xl mb-3"),
				A(Class("text-text text-xl mb-3"), Href("/"), Text("Home")),
			),
			Group(children),
		},
	})
}

func ogp(property, content string) Node {
	return El("meta", Attr("property", "og:"+property), Attr("content", content))
}