2020-11-09 15:40:12 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2021-07-27 10:51:08 +00:00
|
|
|
const robotsTXTPath = "/robots.txt"
|
|
|
|
|
2021-06-06 12:39:42 +00:00
|
|
|
func (a *goBlog) serveRobotsTXT(w http.ResponseWriter, r *http.Request) {
|
2021-07-27 10:51:08 +00:00
|
|
|
if a.isPrivate() {
|
|
|
|
_, _ = w.Write([]byte("User-agent: *\nDisallow: /"))
|
|
|
|
return
|
|
|
|
}
|
2021-06-10 20:09:50 +00:00
|
|
|
_, _ = w.Write([]byte(fmt.Sprintf("User-agent: *\nSitemap: %v", a.getFullAddress(sitemapPath))))
|
2020-11-09 15:40:12 +00:00
|
|
|
}
|