diff --git a/example/simple/example.go b/example/simple/example.go index 1e9fb95..641bd56 100644 --- a/example/simple/example.go +++ b/example/simple/example.go @@ -11,6 +11,7 @@ func createMyRender() multitemplate.Renderer { r := multitemplate.NewRenderer() r.AddFromFiles("index", "templates/base.html", "templates/index.html") r.AddFromFiles("article", "templates/base.html", "templates/index.html", "templates/article.html") + r.AddFromFiles("several", "templates/base_s.html", "templates/article_s.html", "templates/section_s.html") return r } @@ -27,6 +28,11 @@ func main() { "title": "Html5 Article Engine", }) }) + router.GET("/several", func(c *gin.Context) { + c.HTML(200, "several", gin.H{ + "title": "Html5 Several Engine", + }) + }) if err := router.Run(":8080"); err != nil { log.Fatal(err) diff --git a/example/simple/templates/article_s.html b/example/simple/templates/article_s.html new file mode 100644 index 0000000..63e5833 --- /dev/null +++ b/example/simple/templates/article_s.html @@ -0,0 +1,4 @@ +{{define "article"}} +
Hi, this is article template
+{{end}} diff --git a/example/simple/templates/base_s.html b/example/simple/templates/base_s.html new file mode 100644 index 0000000..8c2e9f8 --- /dev/null +++ b/example/simple/templates/base_s.html @@ -0,0 +1,6 @@ +Title {{ .title }}
+ +Hi, this is section template
+{{end}}