Hub
Menu
Sub navigation

Add sitemap.xml

This is also SEO. This file must be updated when you add or edit your content. Although it is not completely static, I find it appropriate to use the misc folder also for this file. This file is also treated as an endpoint in the Go main file:

switch path {
  case "robots.txt":
    http.ServeFile(w, r, "public/misc/robots.txt")
    fmt.Println(path)
  case "sitemap.xml":
    http.ServeFile(w, r, "public/misc/sitemap.xml")
    fmt.Println(path)
  case "contactme":
    contactme(w, r)
  default:
    setheader(w)
    exist := tpl.Lookup(page)
    if exist == nil {
      redirect(w, r) // if not found -> redirect.go
    }
    url := geturl(path)
    tpl.ExecuteTemplate(w, page, url)
  }
}
Generate sitemap.xml