mirror of
https://github.com/aljazceru/njump.git
synced 2025-12-17 14:24:27 +01:00
Set cache-control for profiles and related sitemap/rss
This commit is contained in:
@@ -41,6 +41,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) {
|
|||||||
|
|
||||||
if isSitemap {
|
if isSitemap {
|
||||||
w.Header().Add("content-type", "text/xml")
|
w.Header().Add("content-type", "text/xml")
|
||||||
|
w.Header().Set("Cache-Control", "max-age=86400")
|
||||||
w.Write([]byte(XML_HEADER))
|
w.Write([]byte(XML_HEADER))
|
||||||
SitemapTemplate.Render(w, &SitemapPage{
|
SitemapTemplate.Render(w, &SitemapPage{
|
||||||
Host: s.Domain,
|
Host: s.Domain,
|
||||||
@@ -50,6 +51,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) {
|
|||||||
})
|
})
|
||||||
} else if isRSS {
|
} else if isRSS {
|
||||||
w.Header().Add("content-type", "text/xml")
|
w.Header().Add("content-type", "text/xml")
|
||||||
|
w.Header().Set("Cache-Control", "max-age=86400")
|
||||||
w.Write([]byte(XML_HEADER))
|
w.Write([]byte(XML_HEADER))
|
||||||
RSSTemplate.Render(w, &RSSPage{
|
RSSTemplate.Render(w, &RSSPage{
|
||||||
Host: s.Domain,
|
Host: s.Domain,
|
||||||
@@ -60,6 +62,7 @@ func renderProfile(w http.ResponseWriter, r *http.Request, code string) {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
w.Header().Add("content-type", "text/html")
|
w.Header().Add("content-type", "text/html")
|
||||||
|
w.Header().Set("Cache-Control", "max-age=86400")
|
||||||
err = ProfileTemplate.Render(w, &ProfilePage{
|
err = ProfileTemplate.Render(w, &ProfilePage{
|
||||||
HeadCommonPartial: HeadCommonPartial{IsProfile: true, TailwindDebugStuff: tailwindDebugStuff},
|
HeadCommonPartial: HeadCommonPartial{IsProfile: true, TailwindDebugStuff: tailwindDebugStuff},
|
||||||
DetailsPartial: DetailsPartial{
|
DetailsPartial: DetailsPartial{
|
||||||
|
|||||||
Reference in New Issue
Block a user