Set cache-control for profiles and related sitemap/rss

This commit is contained in:
Daniele Tonon
2023-12-20 07:49:03 +01:00
parent 8e1e6bbf8f
commit c3c9e3d08d

View File

@@ -41,6 +41,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) {
if isSitemap {
w.Header().Add("content-type", "text/xml")
w.Header().Set("Cache-Control", "max-age=86400")
w.Write([]byte(XML_HEADER))
SitemapTemplate.Render(w, &SitemapPage{
Host: s.Domain,
@@ -50,6 +51,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) {
})
} else if isRSS {
w.Header().Add("content-type", "text/xml")
w.Header().Set("Cache-Control", "max-age=86400")
w.Write([]byte(XML_HEADER))
RSSTemplate.Render(w, &RSSPage{
Host: s.Domain,
@@ -60,6 +62,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) {
})
} else {
w.Header().Add("content-type", "text/html")
w.Header().Set("Cache-Control", "max-age=86400")
err = ProfileTemplate.Render(w, &ProfilePage{
HeadCommonPartial: HeadCommonPartial{IsProfile: true, TailwindDebugStuff: tailwindDebugStuff},
DetailsPartial: DetailsPartial{