// Copyright 2015 The Gogs Authors. All rights reserved.
// Copyright 2018 Gitote. All rights reserved.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

package user

import (
	"encoding/xml"
	"net/http"
)

// Urlset stores sitemap tags
type Urlset struct {
	Loc        string `xml:"url>loc"`
	Changefreq string `xml:"url>changefreq"`
	Priority   string `xml:"url>priority"`
}

// Sitemap shows users sitemap
func Sitemap(w http.ResponseWriter, r *http.Request) {
	profile := Urlset{"https://gitote.in/", "Daily", "1.0"}

	x, err := xml.MarshalIndent(profile, "", "  ")
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	w.Header().Set("Content-Type", "application/xml")
	w.Write(x)
}
