有gin-gonic网络应用程序。

有3个文件:

1)base.html-基本布局文件

<!DOCTYPE html>
<html lang="en">
<body>

header...

{{template "content" .}}

footer...

</body>
</html>

2)page1.html,用于/ page1

{{define "content"}}
<div>
    <h1>Page1</h1>
</div>
{{end}}
{{template "base.html"}}

3)page2.html,用于/ page2

{{define "content"}}
<div>
    <h1>Page2</h1>
</div>
{{end}}
{{template "base.html"}}
{{define "content"}}{{template "base.html"}}

拜托,你能举例说明如何在golang中使用基本布局吗?