Simple blogging system written in Go https://goblog.app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
637 B

package main
import "net/http"
const customPageContextKey = "custompage"
func (a *goBlog) serveCustomPage(w http.ResponseWriter, r *http.Request) {
page := r.Context().Value(customPageContextKey).(*customPage)
if a.cfg.Cache != nil && a.cfg.Cache.Enable && page.Cache {
if page.CacheExpiration != 0 {
setInternalCacheExpirationHeader(w, r, page.CacheExpiration)
} else {
setInternalCacheExpirationHeader(w, r, int(a.cfg.Cache.Expiration))
}
}
a.render(w, r, page.Template, &renderData{
BlogString: r.Context().Value(blogContextKey).(string),
Canonical: a.getFullAddress(page.Path),
Data: page.Data,
})
}