Merge 029b60d02eceb73f1a1616d62d2f40c24c552f53 into 53799774f45a119234a89f791565e53aa26b4482

This commit is contained in:
Shuai Qi 2017-06-12 09:01:13 +00:00 committed by GitHub
commit c8b25699a5

View File

@ -570,14 +570,15 @@ Using templates with same name in different directories
```go
func main() {
router := gin.Default()
router.LoadHTMLGlob("templates/**/*")
router.LoadHTMLGlob("templates/posts/*")
router.GET("/posts/index", func(c *gin.Context) {
c.HTML(http.StatusOK, "posts/index.tmpl", gin.H{
c.HTML(http.StatusOK, "index.tmpl", gin.H{
"title": "Posts",
})
})
router.LoadHTMLGlob("templates/users/*")
router.GET("/users/index", func(c *gin.Context) {
c.HTML(http.StatusOK, "users/index.tmpl", gin.H{
c.HTML(http.StatusOK, "index.tmpl", gin.H{
"title": "Users",
})
})