【发布时间】:2015-09-13 11:31:03
【问题描述】:
我尝试在马提尼中呈现我的页面 布局.html
<!DOCTYPE html>
<html lang="en">
<head>...</head>
<header>...</header>
{{ yield }}
<footer>...</footer>
</html>
index.html
<main>
<h1>Hello</h1>
</main>
渲染选项:
m.Use(render.Renderer(render.Options{
Directory: "templates",
Layout: "layout",
Extensions: []string{".tmpl", ".html"},
Delims: render.Delims{"{[{", "}]}"},
Charset: "UTF-8",
IndentJSON: true,
}))
尝试显示页面:
rnd.HTML(200, "edit", nil)
运行应用程序并查看我的页面:
layout.html 中的所有代码都正常处理,但 {{ yield }} 字符串保持不变。
【问题讨论】: