sitemap.go 512 B

1234567891011121314151617181920212223242526
  1. package user
  2. import (
  3. "encoding/xml"
  4. "net/http"
  5. )
  6. type Urlset struct {
  7. Loc string `xml:"url>loc"`
  8. Changefreq string `xml:"url>changefreq"`
  9. Priority string `xml:"url>priority"`
  10. }
  11. func Sitemap(w http.ResponseWriter, r *http.Request) {
  12. profile := Urlset{"https://gitote.in/", "Daily", "1.0"}
  13. x, err := xml.MarshalIndent(profile, "", " ")
  14. if err != nil {
  15. http.Error(w, err.Error(), http.StatusInternalServerError)
  16. return
  17. }
  18. w.Header().Set("Content-Type", "application/xml")
  19. w.Write(x)
  20. }