Merge pull request #52 from sgvictorino/xml-fixes

Fix some validation errors in the Atom xml
This commit is contained in:
daniele
2024-03-04 16:23:24 +01:00
committed by GitHub
3 changed files with 13 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ type SitemapPage struct {
ModifiedAt string
// for the profile sitemap
Npub string
Metadata Metadata
// for the relay sitemap
RelayHostname string
@@ -46,7 +46,6 @@ type RSSPage struct {
Title string
// for the profile RSS
Npub string
Metadata Metadata
// for the relay RSS

View File

@@ -1,29 +1,33 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<updated>{{.ModifiedAt}}</updated>
<generator>https://{{.Host}}</generator>
{{if not (eq "" .Npub)}}
{{if not (eq "" .Metadata.Npub)}}
<title>Nostr notes by {{.Metadata.Name}}</title>
<author>
<name>{{.Metadata.Name}}</name>
</author>
<link href="https://{{.Host}}/{{.Npub}}" />
<id>{{.Npub}}</id>
<link rel="self" type="application/atom+xml" href="https://{{.Host}}/{{.Metadata.Npub}}.rss" />
<link href="https://{{.Host}}/{{.Metadata.Npub}}" />
<id>https://{{.Host}}/{{.Metadata.Npub}}</id>
<icon>{{.Metadata.Picture}}</icon>
<logo>{{.Metadata.Picture}}</logo>
{{end}}
{{if not (eq "" .RelayHostname)}}
<title>Nostr notes on {{.RelayHostname}}</title>
<link href="https://{{.Host}}/r/{{.RelayHostname}}" />
<id>{{.RelayHostname}}</id>
<link rel="self" type="application/atom+xml" href="https://{{.Host}}/r/{{.RelayHostname}}.rss" />
<id>https://{{.Host}}/r/{{.RelayHostname}}</id>
<icon>{{.Info.Icon}}</icon>
<logo>{{.Info.Icon}}</logo>
{{end}}
{{range $i, $ee := .LastNotes}}
<entry>
<id>{{$ee.Nevent}}</id>
<id>https://{{$.Host}}/{{$ee.Nevent}}</id>
{{if not (eq "" $ee.RssTitle)}}
<title>{{$ee.RssTitle}}</title>
<title type="html">{{$ee.RssTitle}}</title>
{{else}}
<title>Nostr event {{$ee.Nevent}}</title>
{{end}}
<link rel="alternate" href="https://{{$.Host}}/{{$ee.Nevent}}" />
<content type="html">

View File

@@ -1,7 +1,7 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{if not (eq "" .Npub)}}
{{if not (eq "" .Metadata.Npub)}}
<url>
<loc>https://{{.Host}}/{{.Npub}}</loc>
<loc>https://{{.Host}}/{{.Metadata.Npub}}</loc>
<lastmod>{{.ModifiedAt}}</lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>