Skip to content
Thanatat Tamtan edited this page Aug 21, 2018 · 9 revisions

When some template have to use for multiple view, component can be use in this case.

For example

app.Template().
	ParseFiles("index", "index.tmpl", "layout.tmpl", "footer.tmpl").
	ParseFiles("about-us", "about-us.tmpl", "layout.tmpl", "footer.tmpl")

Can rewrite to use component

app.Template().
	Component("layout.tmpl", "footer.tmpl").
	ParseFiles("index", "index.tmpl").
	ParseFiles("about-us", "about-us.tmpl")

Next, see how to Config hime from file.

Clone this wiki locally