diff --git a/render.go b/render.go index b2b2c0d..c709423 100644 --- a/render.go +++ b/render.go @@ -431,7 +431,7 @@ func render(w http.ResponseWriter, r *http.Request) { "lastNotes": data.renderableLastNotes, "parentNevent": data.parentNevent, "authorRelays": data.authorRelays, - "CanonicalHost": s.CanonicalHost, + "s": s, } // if a mapping is not found fallback to raw diff --git a/render_archive.go b/render_archive.go index e5bf1fd..d3f46b6 100644 --- a/render_archive.go +++ b/render_archive.go @@ -86,7 +86,7 @@ func renderArchive(w http.ResponseWriter, r *http.Request) { "paginationUrl": area, "nextPage": fmt.Sprint(nextPage), "prevPage": fmt.Sprint(prevPage), - "CanonicalHost": s.CanonicalHost, + "s": s, } if len(data) != 0 { diff --git a/render_homepage.go b/render_homepage.go index b202a7f..4e8a992 100644 --- a/render_homepage.go +++ b/render_homepage.go @@ -37,6 +37,7 @@ func renderHomepage(w http.ResponseWriter, r *http.Request) { } params := map[string]any{ + "s": s, "npubs": npubs, "lastNotes": lastNotes, } diff --git a/render_relay.go b/render_relay.go index f19877f..2a13342 100644 --- a/render_relay.go +++ b/render_relay.go @@ -68,13 +68,13 @@ func renderRelayPage(w http.ResponseWriter, r *http.Request) { "clients": []ClientReference{ {Name: "Coracle", URL: "https://coracle.social/relays/" + hostname}, }, - "type": "relay", - "info": info, - "hostname": hostname, - "proxy": "https://" + hostname + "/njump/proxy?src=", - "lastNotes": renderableLastNotes, - "modifiedAt": lastEventAt.Format("2006-01-02T15:04:05Z07:00"), - "CanonicalHost": s.CanonicalHost, + "type": "relay", + "info": info, + "hostname": hostname, + "proxy": "https://" + hostname + "/njump/proxy?src=", + "lastNotes": renderableLastNotes, + "modifiedAt": lastEventAt.Format("2006-01-02T15:04:05Z07:00"), + "s": s, } if len(renderableLastNotes) != 0 { diff --git a/render_robots.go b/render_robots.go index 3c88bd0..d569e6a 100644 --- a/render_robots.go +++ b/render_robots.go @@ -9,7 +9,7 @@ func renderRobots(w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "max-age=3600") params := map[string]any{ - "CanonicalHost": s.CanonicalHost, + "s": s, } if err := tmpl.ExecuteTemplate(w, templateMapping[typ], params); err != nil { diff --git a/templates/homepage.html b/templates/homepage.html index 56f4f2d..dff6c61 100644 --- a/templates/homepage.html +++ b/templates/homepage.html @@ -26,31 +26,33 @@ (yet) working.

- njump currently lives under njump.me, you can reach it - appending a nostr (njump currently lives under {{ .s.CanonicalHost }}, you can + reach it appending a Nostr (NIP-19) entity (npub, nevent, naddr, etc) after the domain: - njump.me/<nip-19-entity>. + {{ .s.CanonicalHost }}/<nip-19-entity>.

For example, here's a user profile, a note and a long blog post.

@@ -60,7 +62,7 @@
-
njump.me/
+
{{ .s.CanonicalHost }}/
NIP-05 inspired permalink: - njump.me/<nip-5>, for - example: - https://njump.me/nvk.org or - https://njump.me/mike@mikedilger.com{{ .s.CanonicalHost }}/<nip-5>, for example: + https://{{ .s.CanonicalHost }}/nvk.org or + https://{{ .s.CanonicalHost }}/mike@mikedilger.com.

@@ -153,10 +155,11 @@

Bonus 2: Relays view

You can have a view of the last content posted to a relay using - njump.me/r/<relay-host>, for - example: - https://njump.me/r/nostr.wine{{ .s.CanonicalHost }}/r/<relay-host>, for example: + https://{{ .s.CanonicalHost }}/r/nostr.wine

diff --git a/templates/note.html b/templates/note.html index 6e96e28..df9c342 100644 --- a/templates/note.html +++ b/templates/note.html @@ -40,7 +40,7 @@ {{template "head_common.html"}} diff --git a/templates/profile.html b/templates/profile.html index 90859a7..fd34d77 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -2,8 +2,14 @@ - {{.metadata.Name | escapeString}} / {{.metadata.DisplayName | escapeString}} is on nostr - + + {{.metadata.Name | escapeString}} / {{.metadata.DisplayName | + escapeString}} is on nostr + + {{ if .metadata.Picture }} @@ -20,7 +26,10 @@ {{end}} - +

- {{.metadata.Name | escapeString}} - {{if not (eq .metadata.Name .metadata.DisplayName)}} + {{.metadata.Name | escapeString}} {{if not (eq .metadata.Name + .metadata.DisplayName)}} {{.metadata.DisplayName | escapeString}} @@ -59,8 +68,8 @@

- {{.metadata.Name | escapeString}} - {{if not (eq .metadata.Name .metadata.DisplayName)}} + {{.metadata.Name | escapeString}} {{if not (eq .metadata.Name + .metadata.DisplayName)}} {{.metadata.DisplayName | escapeString}} @@ -130,7 +139,9 @@
- reply
{{end}}

-
{{.Content | escapeString | previewNotesFormatting}}
+
+ {{.Content | escapeString | previewNotesFormatting}} +
{{end}} diff --git a/templates/robots.txt b/templates/robots.txt index d7722a9..53a8cfe 100644 --- a/templates/robots.txt +++ b/templates/robots.txt @@ -1,5 +1,5 @@ User-agent: * Allow: / -Sitemap: https://{{.CanonicalHost}}/npubs-archive.xml -Sitemap: https://{{.CanonicalHost}}/relays-archive.xml \ No newline at end of file +Sitemap: https://{{.s.CanonicalHost}}/npubs-archive.xml +Sitemap: https://{{.s.CanonicalHost}}/relays-archive.xml diff --git a/templates/sitemap.xml b/templates/sitemap.xml index 26884e0..f3a405f 100644 --- a/templates/sitemap.xml +++ b/templates/sitemap.xml @@ -2,7 +2,7 @@ {{if .npub}} - https://{{.CanonicalHost}}/{{.npub | escapeString}} + https://{{.s.CanonicalHost}}/{{.npub | escapeString}} {{.modifiedAt | escapeString}} daily 0.8 @@ -10,7 +10,7 @@ {{end}} {{if .hostname}} - https://{{.CanonicalHost}}/r/{{.hostname | escapeString}} + https://{{.s.CanonicalHost}}/r/{{.hostname | escapeString}} {{.modifiedAt | escapeString}} daily 0.8 @@ -19,7 +19,7 @@ {{if .lastNotes}} {{range .lastNotes}} - https://{{$.CanonicalHost}}/{{.Nevent | escapeString}} + https://{{.s.CanonicalHost}}/{{.Nevent | escapeString}} {{.ModifiedAt | escapeString}} never 0.5 @@ -29,7 +29,7 @@ {{if .data}} {{range $element := .data }} - https://{{$.CanonicalHost}}/{{$.pathPrefix}}{{$element | trimProtocol | escapeString}} + https://{{.s.CanonicalHost}}/{{$.pathPrefix}}{{$element | trimProtocol | escapeString}} {{$.modifiedAt | escapeString}} daily 0.5