我目前将所有 html 文件都放在一个平面目录templates/中,并且我将所有内容都加载到
tmpl := template.Must(template.ParseGlob("templates/*.html"))但我现在想引入一些结构并将模板放入文件夹、components、base等。但是当我这样做时,我的网站停止工作。我在想可能是上述情况,还是我需要引用模板中的路径?
例子
{{ template "navbar" }}会成为
{{ template "components/navbar" }}有点迷茫...
我现在也在使用本机 go 库而不是框架。
ibeautiful
慕码人2483693
随时随地看视频慕课网APP
相关分类