Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mgdm/go-templates-question


https://github.com/mgdm/go-templates-question

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

I had hoped that I could build a webapp and embed all the templates using `//go:embed`, parse them all into one `template.Template` instance, and then later use `ExecuteTemplate` on that to render the right template for each page. However, I can't seem to make that work, I get the wrong template executed no matter what order I load the templates in, and whether I use `ParseFiles`, `ParseFS`, or `ParseGlob`.

Anyone know why? Do I need a separate `template.Template` instance for each page?