1
mirror of https://gitlab.com/commento/commento.git synced 2025-06-29 22:56:37 -04:00

everywhere: use common html to generate footer

This commit is contained in:
Adhityaa
2018-06-22 19:27:19 +05:30
parent c1c2a19842
commit 584698df94
6 changed files with 34 additions and 89 deletions

View File

@ -22,6 +22,7 @@ type staticAssetPlugs struct {
type staticHtmlPlugs struct {
CdnPrefix string
Footer template.HTML
}
func initStaticRouter(router *mux.Router) error {
@ -80,6 +81,12 @@ func initStaticRouter(router *mux.Router) error {
}
}
footer, err := ioutil.ReadFile(os.Getenv("STATIC") + string(os.PathSeparator) + "footer.html")
if err != nil {
logger.Errorf("cannot read file footer.html: %v", err)
return err
}
pages := []string{
"login",
"forgot",
@ -108,7 +115,7 @@ func initStaticRouter(router *mux.Router) error {
}
var buf bytes.Buffer
t.Execute(&buf, &staticHtmlPlugs{CdnPrefix: os.Getenv("CDN_PREFIX")})
t.Execute(&buf, &staticHtmlPlugs{CdnPrefix: os.Getenv("CDN_PREFIX"), Footer: template.HTML(string(footer))})
html[page] = buf.String()
}