+2
-2
handlers/routes.go
+2
-2
handlers/routes.go
···
18
18
panic(result.Error)
19
19
}
20
20
21
-
layouts.RenderDefault(pages.Home(posts)).ServeHTTP(w, r)
21
+
layouts.RenderDefault("", pages.Home(posts)).ServeHTTP(w, r)
22
22
}
23
23
24
24
func ServePostPage(w http.ResponseWriter, r *http.Request) {
···
32
32
return
33
33
}
34
34
35
-
layouts.RenderDefault(pages.Post(post)).ServeHTTP(w, r)
35
+
layouts.RenderDefault(string(post.MicroformatType), pages.Post(post)).ServeHTTP(w, r)
36
36
}
+8
-4
html/layouts/default.templ
+8
-4
html/layouts/default.templ
···
3
3
import "net/http"
4
4
import "github.com/puregarlic/space/storage"
5
5
6
-
func RenderDefault(page templ.Component) http.Handler {
6
+
func RenderDefault(title string, page templ.Component) http.Handler {
7
7
rels := storage.GetRels()
8
-
document := Default(page, rels)
8
+
document := Default(title, page, rels)
9
9
10
10
return templ.Handler(document)
11
11
}
12
12
13
-
templ Default(body templ.Component, rels []*storage.RelEntry) {
13
+
templ Default(title string, body templ.Component, rels []*storage.RelEntry) {
14
14
<!DOCTYPE html>
15
15
<html>
16
16
<head>
17
-
<title>puregarlic dot space</title>
17
+
if len(title) > 0 {
18
+
<title>{title} | puregarlic dot space</title>
19
+
} else {
20
+
<title>puregarlic dot space</title>
21
+
}
18
22
<meta name="viewport" content="width=device-width, initial-scale=1" />
19
23
<link rel="preconnect" href="https://fonts.googleapis.com" />
20
24
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+39
-11
html/layouts/default_templ.go
+39
-11
html/layouts/default_templ.go
···
11
11
import "net/http"
12
12
import "github.com/puregarlic/space/storage"
13
13
14
-
func RenderDefault(page templ.Component) http.Handler {
14
+
func RenderDefault(title string, page templ.Component) http.Handler {
15
15
rels := storage.GetRels()
16
-
document := Default(page, rels)
16
+
document := Default(title, page, rels)
17
17
18
18
return templ.Handler(document)
19
19
}
20
20
21
-
func Default(body templ.Component, rels []*storage.RelEntry) templ.Component {
21
+
func Default(title string, body templ.Component, rels []*storage.RelEntry) templ.Component {
22
22
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
23
23
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
24
24
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
···
36
36
templ_7745c5c3_Var1 = templ.NopComponent
37
37
}
38
38
ctx = templ.ClearChildren(ctx)
39
-
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html><head><title>puregarlic dot space</title><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin><link href=\"https://fonts.googleapis.com/css2?family=Recursive:slnt,wght,CASL,CRSV,MONO@-15..0,300..1000,0..1,0..1,0..1&display=swap\" rel=\"stylesheet\">")
39
+
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html><head>")
40
40
if templ_7745c5c3_Err != nil {
41
41
return templ_7745c5c3_Err
42
42
}
43
-
for _, rel := range rels {
44
-
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<link rel=\"")
43
+
if len(title) > 0 {
44
+
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<title>")
45
45
if templ_7745c5c3_Err != nil {
46
46
return templ_7745c5c3_Err
47
47
}
48
48
var templ_7745c5c3_Var2 string
49
-
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(rel.Name)
49
+
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
50
50
if templ_7745c5c3_Err != nil {
51
-
return templ.Error{Err: templ_7745c5c3_Err, FileName: `html/layouts/default.templ`, Line: 24, Col: 28}
51
+
return templ.Error{Err: templ_7745c5c3_Err, FileName: `html/layouts/default.templ`, Line: 18, Col: 21}
52
52
}
53
53
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
54
54
if templ_7745c5c3_Err != nil {
55
55
return templ_7745c5c3_Err
56
56
}
57
-
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" href=\"")
57
+
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | puregarlic dot space</title>")
58
+
if templ_7745c5c3_Err != nil {
59
+
return templ_7745c5c3_Err
60
+
}
61
+
} else {
62
+
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<title>puregarlic dot space</title>")
63
+
if templ_7745c5c3_Err != nil {
64
+
return templ_7745c5c3_Err
65
+
}
66
+
}
67
+
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin><link href=\"https://fonts.googleapis.com/css2?family=Recursive:slnt,wght,CASL,CRSV,MONO@-15..0,300..1000,0..1,0..1,0..1&display=swap\" rel=\"stylesheet\">")
68
+
if templ_7745c5c3_Err != nil {
69
+
return templ_7745c5c3_Err
70
+
}
71
+
for _, rel := range rels {
72
+
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<link rel=\"")
58
73
if templ_7745c5c3_Err != nil {
59
74
return templ_7745c5c3_Err
60
75
}
61
76
var templ_7745c5c3_Var3 string
62
-
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(rel.HREF)
77
+
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(rel.Name)
63
78
if templ_7745c5c3_Err != nil {
64
-
return templ.Error{Err: templ_7745c5c3_Err, FileName: `html/layouts/default.templ`, Line: 24, Col: 46}
79
+
return templ.Error{Err: templ_7745c5c3_Err, FileName: `html/layouts/default.templ`, Line: 28, Col: 28}
65
80
}
66
81
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
82
+
if templ_7745c5c3_Err != nil {
83
+
return templ_7745c5c3_Err
84
+
}
85
+
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" href=\"")
86
+
if templ_7745c5c3_Err != nil {
87
+
return templ_7745c5c3_Err
88
+
}
89
+
var templ_7745c5c3_Var4 string
90
+
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(rel.HREF)
91
+
if templ_7745c5c3_Err != nil {
92
+
return templ.Error{Err: templ_7745c5c3_Err, FileName: `html/layouts/default.templ`, Line: 28, Col: 46}
93
+
}
94
+
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
67
95
if templ_7745c5c3_Err != nil {
68
96
return templ_7745c5c3_Err
69
97
}
+1
-1
services/indieauth.go
+1
-1
services/indieauth.go
···
57
57
nonceId, nonce := nanoid.New(), nanoid.New()
58
58
storage.NonceCache().Set(nonceId, nonce, 0)
59
59
60
-
layouts.RenderDefault(pages.Auth(req, app, nonceId, nonce)).ServeHTTP(w, r)
60
+
layouts.RenderDefault("authorize", pages.Auth(req, app, nonceId, nonce)).ServeHTTP(w, r)
61
61
}
62
62
63
63
func (i *IndieAuth) HandleAuthPOST(w http.ResponseWriter, r *http.Request) {