2020-10-13 11:40:16 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
2021-02-20 22:35:16 +00:00
|
|
|
func serveCustomPage(blog *configBlog, page *customPage) func(http.ResponseWriter, *http.Request) {
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
2020-11-20 14:33:20 +00:00
|
|
|
if appConfig.Cache != nil && appConfig.Cache.Enable && page.Cache {
|
|
|
|
if page.CacheExpiration != 0 {
|
|
|
|
setInternalCacheExpirationHeader(w, page.CacheExpiration)
|
|
|
|
} else {
|
|
|
|
setInternalCacheExpirationHeader(w, int(appConfig.Cache.Expiration))
|
|
|
|
}
|
|
|
|
}
|
2021-02-20 22:35:16 +00:00
|
|
|
render(w, r, page.Template, &renderData{
|
2020-11-01 17:37:21 +00:00
|
|
|
Blog: blog,
|
|
|
|
Canonical: appConfig.Server.PublicAddress + page.Path,
|
|
|
|
Data: page.Data,
|
2020-10-13 11:40:16 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|