Simple blogging system written in Go https://goblog.app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
GoBlog/robotstxt.go

21 lines
513 B

package main
import (
"fmt"
"net/http"
)
const robotsTXTPath = "/robots.txt"
func (a *goBlog) serveRobotsTXT(w http.ResponseWriter, _ *http.Request) {
_, _ = fmt.Fprint(w, "User-agent: *\n")
if a.isPrivate() {
_, _ = fmt.Fprint(w, "Disallow: /\n")
return
}
_, _ = fmt.Fprint(w, "Allow: /\n\n")
_, _ = fmt.Fprintf(w, "Sitemap: %s\n", a.getFullAddress(sitemapPath))
for _, bc := range a.cfg.Blogs {
_, _ = fmt.Fprintf(w, "Sitemap: %s\n", a.getFullAddress(bc.getRelativePath(sitemapBlogPath)))
}
}