When some templates have to be used for multiple views, preload can be used in this case.
For example
t := app.Template() t.ParseFiles("index", "index.tmpl", "layout.tmpl", "footer.tmpl") t.ParseFiles("about-us", "about-us.tmpl", "layout.tmpl", "footer.tmpl")
Can rewrite to use preload
t := app.Template() t.Preload("layout.tmpl", "footer.tmpl") t.ParseFiles("index", "index.tmpl") t.ParseFiles("about-us", "about-us.tmpl")
Next, see how to Config hime from file.
And see how to load html/template into template using Component
There was an error while loading. Please reload this page.