goview
goview copied to clipboard
What file structure should I create to minimize duplication of html code?
Hi. I have such a file structure, index.html the main one, css styles and scripts are connected in it

the data that differ I have taken out in partials, I would like to index.html output {{template "ext" .}} or {{template "conf" .}} depending on the current page or get the parameter, is it possible to do this? Create a copy index.html , but with {{template "conf" .}} I would not like to because there can be a large number of pages

Why not use master layout file?
goview.Config{
Root: "views", //template root path
Extension: ".tpl", //file extension
Master: "layouts/master", //master layout file
Partials: []string{"partials/head"}, //partial files
Funcs: template.FuncMap{
"sub": func(a, b int) int {
return a - b
},
// more funcs
},
DisableCache: false, //if disable cache, auto reload template file for debug.
Delims: Delims{Left: "{{", Right: "}}"},
}