Last active
March 22, 2022 11:38
-
-
Save cp-sumi-k/ecfba4f819b7f63854d5e80dbcba588f to your computer and use it in GitHub Desktop.
https://medium.com/canopas/automation-dynamic-sitemap-generation-with-golang-api-584f6c53ea9c - sitemap-4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add changefreq and lastmod to all urls | |
year, month, _ := time.Now().Date() //get current month and year | |
lastmod := time.Date(year, month, 1, 0, 0, 0, 0, time.UTC).Format("2006-01-02T00:00:00.000Z") | |
for i := range sitemapUrls { | |
sitemapUrls[i].ChangeFreq = "monthly" | |
sitemapUrls[i].LastMod = lastmod | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment