all repos — homestead @ main

Code for my website

internal/publisher/templates/layout.go (view 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
37
38
39
40
package templates

import (
	base "go.alanpearce.eu/homestead/templates"

	g "go.alanpearce.eu/gomponents"
	c "go.alanpearce.eu/gomponents/components"
	. "go.alanpearce.eu/gomponents/html"
)

func Layout(site base.SiteSettings, page base.PageSettings, children ...g.Node) g.Node {
	return c.HTML5(c.HTML5Props{
		Title:       site.Title,
		Description: "",
		Language:    site.Language,
		Head: []g.Node{
			Link(
				Rel("stylesheet"),
				Href("/style.css"),
			),
		},
		Body: []g.Node{
			Header(
				H1(A(
					base.ExtendAttrs(base.Attrs{
						"class": "title",
						"href":  "/",
					}, page.TitleAttrs),
					g.Text(site.Title),
				)),
			),
			Main(ID("main"), g.Group(children)),
			Footer(
				A(Href("https://git.alanpearce.eu/homestead"), g.Text("Source Code")),
			),
			g.If(site.InjectLiveReload, base.LiveReload),
		},
		HTMLAttrs: []g.Node{},
	})
}