mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-18 14:54:24 +01:00
make robots.txt rendering a simple string thing.
This commit is contained in:
1
main.go
1
main.go
@@ -78,7 +78,6 @@ func main() {
|
|||||||
"relay_sitemap": "sitemap.xml",
|
"relay_sitemap": "sitemap.xml",
|
||||||
"archive": "archive.html",
|
"archive": "archive.html",
|
||||||
"archive_sitemap": "sitemap.xml",
|
"archive_sitemap": "sitemap.xml",
|
||||||
"robots": "robots.txt",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
funcMap := template.FuncMap{
|
funcMap := template.FuncMap{
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func renderRobots(w http.ResponseWriter, r *http.Request) {
|
func renderRobots(w http.ResponseWriter, r *http.Request) {
|
||||||
typ := "robots"
|
|
||||||
w.Header().Set("Cache-Control", "max-age=3600")
|
w.Header().Set("Cache-Control", "max-age=3600")
|
||||||
|
fmt.Fprintf(w, `User-agent: *
|
||||||
|
Allow: /
|
||||||
|
|
||||||
params := map[string]any{}
|
Sitemap: https://{{%s}}/npubs-archive.xml
|
||||||
|
Sitemap: https://{{%s}}/relays-archive.xml
|
||||||
if err := tmpls.ExecuteTemplate(w, templateMapping[typ], params); err != nil {
|
`, s.CanonicalHost, s.CanonicalHost)
|
||||||
log.Error().Err(err).Msg("error rendering")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
User-agent: *
|
|
||||||
Allow: /
|
|
||||||
|
|
||||||
Sitemap: https://{{s.CanonicalHost}}/npubs-archive.xml
|
|
||||||
Sitemap: https://{{s.CanonicalHost}}/relays-archive.xml
|
|
||||||
Reference in New Issue
Block a user