22 lines
536 B
Go
22 lines
536 B
Go
package handler
|
|
|
|
import "html/template"
|
|
|
|
// CurrentTheme is the set of template being used.
|
|
var CurrentTheme *template.Template
|
|
|
|
// SetTheme parses the provided theme name and sets it as the current theme.
|
|
func SetTheme(themeName string) error {
|
|
var err error
|
|
|
|
folder := "templates/" + themeName + "/"
|
|
CurrentTheme, err = template.ParseFiles(
|
|
folder+"index.tmpl", // Homepage (listing).
|
|
folder+"404.tmpl", // Post not found.
|
|
folder+"500.tmpl", // Internal error.
|
|
folder+"post.tmpl", // Page for posts.
|
|
)
|
|
|
|
return err
|
|
}
|