Fix #2 (removing unaired LPs from Sitemap)

This commit is contained in:
Andreas Mieke 2016-03-05 10:24:26 +01:00
parent c392b53083
commit b8e0e74f73

View file

@ -40,17 +40,17 @@ func GenerateSitemap() {
temp.ChangeFreq = "hourly"
temp.Priority = 1.0
uset.Url = append(uset.Url, temp)
temp.Location = config.C.SiteUrl + "/lets-play"
temp.Location = config.C.SiteUrl + "/lets-play/"
temp.LastMod = time.Now()
temp.ChangeFreq = "monthly"
temp.Priority = 0.75
uset.Url = append(uset.Url, temp)
temp.Location = config.C.SiteUrl + "/testet"
temp.Location = config.C.SiteUrl + "/testet/"
temp.LastMod = time.Now()
temp.ChangeFreq = "monthly"
temp.Priority = 0.75
uset.Url = append(uset.Url, temp)
temp.Location = config.C.SiteUrl + "/zeige"
temp.Location = config.C.SiteUrl + "/zeige/"
temp.LastMod = time.Now()
temp.ChangeFreq = "yearly"
temp.Priority = 0.75
@ -65,12 +65,14 @@ func genLPs(uset *urlset) {
var LPs []database.LetsPlay
database.Db.Where("aired IS NOT NULL").Find(&LPs)
for _, LP := range LPs {
var temp URL
temp.Location = config.C.SiteUrl + "/lets-play/" + LP.Slug.String
temp.LastMod = LP.Aired
temp.ChangeFreq = "daily"
temp.Priority = 0.5
uset.Url = append(uset.Url, temp)
if LP.Aired.IsZero() == false {
var temp URL
temp.Location = config.C.SiteUrl + "/lets-play/" + LP.Slug.String + "/"
temp.LastMod = LP.Aired
temp.ChangeFreq = "daily"
temp.Priority = 0.5
uset.Url = append(uset.Url, temp)
}
}
}
@ -79,7 +81,7 @@ func genLTs(uset *urlset) {
database.Db.Find(&LTs)
for _, LT := range LTs {
var temp URL
temp.Location = config.C.SiteUrl + "/testet/" + LT.Slug.String
temp.Location = config.C.SiteUrl + "/testet/" + LT.Slug.String + "/"
temp.LastMod = LT.Aired
temp.ChangeFreq = "never"
temp.Priority = 0.5
@ -91,13 +93,15 @@ func genEPs(uset *urlset) {
var EPs []database.Episode
database.Db.Find(&EPs)
for _, EP := range EPs {
var LP database.LetsPlay
database.Db.Model(&EP).Related(&LP)
var temp URL
temp.Location = config.C.SiteUrl + "/lets-play/" + LP.Slug.String + "/" + EP.Slug.String
temp.LastMod = EP.Aired
temp.ChangeFreq = "never"
temp.Priority = 0.5
uset.Url = append(uset.Url, temp)
if EP.Aired.IsZero() == false {
var LP database.LetsPlay
database.Db.Model(&EP).Related(&LP)
var temp URL
temp.Location = config.C.SiteUrl + "/lets-play/" + LP.Slug.String + "/" + EP.Slug.String + "/"
temp.LastMod = EP.Aired
temp.ChangeFreq = "never"
temp.Priority = 0.5
uset.Url = append(uset.Url, temp)
}
}
}