GoBlog/robotstxt.go

15 lines
354 B
Go

package main
import (
"fmt"
"net/http"
)
func (a *goBlog) serveRobotsTXT(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(fmt.Sprintf("User-agent: *\nSitemap: %v", a.cfg.Server.PublicAddress+sitemapPath)))
}
func servePrivateRobotsTXT(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte("User-agent: *\nDisallow: /"))
}