I'm using Go
version 1.8.1
with Gin
framework and my project structure like below
|- src/
|- views/
|- category1/
|- layout/
- header.html
- footer.html
- index.html
|- category2/
|- layout/
- header.html
- footer.html
- index.html
|- category3/
|- layout/
- header.html
- footer.html
- index.html
in each of the index.html
I have to include same level header and footer files from layout
folder, to do that for category1
folder index.html
I wrote like below
{{ template "views/category1/layout/header.html" .}}
<body>
<h1>Category 1</h1>
</body>
{{ template "views/category1/layout/footer.html" .}}
and in Gin
I loaded all files using
router.LoadHTMLGlob("views/*/*/*.html")
but it is not working as I expected, it is giving following error
html/template:index.html no such template "views/category1/layout/header.html"
html/template:index.html no such template "views/category1/layout/footer.html"