Add generic day path to sitemap

This commit is contained in:
Jan-Lukas Else 2021-06-27 20:59:11 +02:00
parent 73a848ad82
commit 1e0b97b4d4
1 changed files with 12 additions and 4 deletions

View File

@ -58,7 +58,7 @@ func (a *goBlog) serveSitemap(w http.ResponseWriter, r *http.Request) {
}) })
already[yearPath] = true already[yearPath] = true
} }
// Specific month // Month
monthPath := yearPath + "/" + fmt.Sprintf("%02d", d.month) monthPath := yearPath + "/" + fmt.Sprintf("%02d", d.month)
if !already[monthPath] { if !already[monthPath] {
sm.Add(&sitemap.URL{ sm.Add(&sitemap.URL{
@ -66,7 +66,7 @@ func (a *goBlog) serveSitemap(w http.ResponseWriter, r *http.Request) {
}) })
already[monthPath] = true already[monthPath] = true
} }
// Specific day // Day
dayPath := monthPath + "/" + fmt.Sprintf("%02d", d.day) dayPath := monthPath + "/" + fmt.Sprintf("%02d", d.day)
if !already[dayPath] { if !already[dayPath] {
sm.Add(&sitemap.URL{ sm.Add(&sitemap.URL{
@ -74,7 +74,7 @@ func (a *goBlog) serveSitemap(w http.ResponseWriter, r *http.Request) {
}) })
already[dayPath] = true already[dayPath] = true
} }
// Generic month // XXXX-MM
genericMonthPath := bc.getRelativePath("/x/" + fmt.Sprintf("%02d", d.month)) genericMonthPath := bc.getRelativePath("/x/" + fmt.Sprintf("%02d", d.month))
if !already[genericMonthPath] { if !already[genericMonthPath] {
sm.Add(&sitemap.URL{ sm.Add(&sitemap.URL{
@ -82,7 +82,7 @@ func (a *goBlog) serveSitemap(w http.ResponseWriter, r *http.Request) {
}) })
already[genericMonthPath] = true already[genericMonthPath] = true
} }
// Specific day // XXXX-MM-DD
genericMonthDayPath := genericMonthPath + "/" + fmt.Sprintf("%02d", d.day) genericMonthDayPath := genericMonthPath + "/" + fmt.Sprintf("%02d", d.day)
if !already[genericMonthDayPath] { if !already[genericMonthDayPath] {
sm.Add(&sitemap.URL{ sm.Add(&sitemap.URL{
@ -90,6 +90,14 @@ func (a *goBlog) serveSitemap(w http.ResponseWriter, r *http.Request) {
}) })
already[genericMonthDayPath] = true already[genericMonthDayPath] = true
} }
// XXXX-XX-DD
genericDayPath := bc.getRelativePath("/x/x/" + fmt.Sprintf("%02d", d.day))
if !already[genericDayPath] {
sm.Add(&sitemap.URL{
Loc: a.getFullAddress(genericDayPath),
})
already[genericDayPath] = true
}
} }
} }
// Photos // Photos