-
Notifications
You must be signed in to change notification settings - Fork 23
/
xml-pages.go
77 lines (58 loc) · 1.43 KB
/
xml-pages.go
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
_ "embed"
"github.com/nbd-wtf/go-nostr/nip11"
"github.com/nbd-wtf/go-nostr/sdk"
"github.com/tylermmorton/tmpl"
)
var (
//go:embed xml/sitemap.xml
tmplSitemap string
SitemapTemplate = tmpl.MustCompile(&SitemapPage{})
)
type SitemapPage struct {
Host string
ModifiedAt string
// for the profile sitemap
Metadata sdk.ProfileMetadata
// for the relay sitemap
RelayHostname string
Info nip11.RelayInformationDocument
// for the profile and relay sitemaps
LastNotes []EnhancedEvent
// for the archive sitemap
PathPrefix string
Data []string
}
func (*SitemapPage) TemplateText() string { return tmplSitemap }
var (
//go:embed xml/sitemap-index.xml
tmplSitemapIndex string
SitemapIndexTemplate = tmpl.MustCompile(&SitemapIndexPage{})
)
type SitemapIndexPage struct {
Host string
Npubs []string
}
func (*SitemapIndexPage) TemplateText() string { return tmplSitemapIndex }
var (
//go:embed xml/rss.xml
tmplRSS string
RSSTemplate = tmpl.MustCompile(&RSSPage{})
)
type RSSPage struct {
Host string
ModifiedAt string
Title string
// for the profile RSS
Metadata sdk.ProfileMetadata
// for the relay RSS
RelayHostname string
Info nip11.RelayInformationDocument
// for the profile and relay RSSs
LastNotes []EnhancedEvent
// for the archive RSS
PathPrefix string
Data []string
}
func (*RSSPage) TemplateText() string { return tmplRSS }