Use note entity in the sitemap

This commit is contained in:
Daniele Tonon
2023-07-13 11:19:46 +02:00
parent 55c2735ce9
commit 2ea209c1ca
2 changed files with 5 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ import (
)
type Event struct {
Note string
Nevent string
Content string
CreatedAt string
@@ -95,8 +96,10 @@ func render(w http.ResponseWriter, r *http.Request) {
renderableLastNotes = make([]*Event, len(lastNotes))
for i, n := range lastNotes {
nevent, _ := nip19.EncodeEvent(n.ID, []string{}, n.PubKey)
note, _ = nip19.EncodeNote(n.ID)
renderableLastNotes[i] = &Event{
Nevent: nevent,
Note: note,
Content: n.Content,
CreatedAt: time.Unix(int64(n.CreatedAt), 0).Format("2006-01-02 15:04:05"),
ModifiedAt: time.Unix(int64(n.CreatedAt), 0).Format("2006-01-02T15:04:05Z07:00"),

View File

@@ -8,7 +8,7 @@
</url>
{{range .lastNotes}}
<url>
<loc>/{{.Nevent | escapeString}}</loc>
<loc>/{{.Note | escapeString}}</loc>
<lastmod>{{.ModifiedAt | escapeString}}</lastmod>
<changefreq>never</changefreq>
<priority>0.5</priority>