Files
njump/xml-pages.go
2024-01-07 15:48:55 -03:00

66 lines
1.2 KiB
Go

package main
import (
_ "embed"
"github.com/nbd-wtf/go-nostr/nip11"
sdk "github.com/nbd-wtf/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
Npub string
// 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/rss.xml
tmplRSS string
RSSTemplate = tmpl.MustCompile(&RSSPage{})
)
type RSSPage struct {
Host string
ModifiedAt string
Title string
// for the profile RSS
Npub string
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 }