sitemap.go 539 B

123456789101112131415161718192021222324252627282930
  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. for i := 0; i < 0; i++ {
  13. profile := Urlset{"dfsdf", "dgg", "fsdjfn"}
  14. x, err := xml.MarshalIndent(profile, "", " ")
  15. if err != nil {
  16. http.Error(w, err.Error(), http.StatusInternalServerError)
  17. return
  18. }
  19. w.Header().Set("Content-Type", "application/xml")
  20. w.Write(x)
  21. }
  22. }