fix empty pubkey rendering as the first item in all sitemaps.

This commit is contained in:
fiatjaf
2024-06-12 15:53:42 -03:00
parent db39ef65b1
commit 82f08498c2
2 changed files with 4 additions and 4 deletions

View File

@@ -43,13 +43,13 @@ func renderArchive(w http.ResponseWriter, r *http.Request) {
keys := cache.GetPaginatedKeys(prefix, page, 5000)
data := []string{}
for i := 0; i < len(keys); i++ {
for _, key := range keys {
switch area {
case NPUBS_ARCHIVE:
npub, _ := nip19.EncodePublicKey(keys[i][3:])
npub, _ := nip19.EncodePublicKey(key[3:])
data = append(data, npub)
case RELAYS_ARCHIVE:
data = append(data, trimProtocol(keys[i][3:]))
data = append(data, trimProtocol(key[3:]))
}
}

View File

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