I am building a web app with full-stack Golang and the Gin framework. I am using templates to render the frontend. Do anyone know how I can organize my templates folder?
I currently have in the root directory my templates folder, with all my html pages in it. I would like to organise the html pages into different folder. However, when I try to load the whole folder, It does not work quite as expected.
You can see the attached picture for my current project structure. Also, here is how I currently load the templates to my project:
// Serve static files and templates
router.Static("assets", "./assets")
router.LoadHTMLGlob("templates/*.html")
I have try this way as well but it does load only the sub folder:
// Serve static files and templates
router.Static("assets", "./assets")
router.LoadHTMLGlob("templates/**/*.html")
I would like to have a folder for the footer and header for example, and another folder for authentication, and maybe another folder for the main app. Something like that, but the way I mentioned above does not seen to work for some reason.
Any guidance/recommendation would be appreciate.