Use plural for template folder name in the example.
This commit is contained in:
		
							
								
								
									
										20
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								README.md
									
									
									
									
									
								
							@ -415,36 +415,36 @@ Using templates with same name in different directories
 | 
				
			|||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
	router := gin.Default()
 | 
						router := gin.Default()
 | 
				
			||||||
	router.LoadHTMLGlob("templates/**/*")
 | 
						router.LoadHTMLGlob("templates/**/*")
 | 
				
			||||||
	router.GET("/post/index", func(c *gin.Context) {
 | 
						router.GET("/posts/index", func(c *gin.Context) {
 | 
				
			||||||
		c.HTML(http.StatusOK, "post/index.tmpl", gin.H{
 | 
							c.HTML(http.StatusOK, "posts/index.tmpl", gin.H{
 | 
				
			||||||
			"title": "Posts",
 | 
								"title": "Posts",
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
	router.GET("/user/index", func(c *gin.Context) {
 | 
						router.GET("/users/index", func(c *gin.Context) {
 | 
				
			||||||
		c.HTML(http.StatusOK, "user/index.tmpl", gin.H{
 | 
							c.HTML(http.StatusOK, "users/index.tmpl", gin.H{
 | 
				
			||||||
			"title": "Users",
 | 
								"title": "Users",
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
	router.Run(":8080")
 | 
						router.Run(":8080")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
templates/post/index.tmpl
 | 
					templates/posts/index.tmpl
 | 
				
			||||||
```html
 | 
					```html
 | 
				
			||||||
{{ define "post/index.tmpl" }}
 | 
					{{ define "posts/index.tmpl" }}
 | 
				
			||||||
<html><h1>
 | 
					<html><h1>
 | 
				
			||||||
	{{ .title }}
 | 
						{{ .title }}
 | 
				
			||||||
</h1>
 | 
					</h1>
 | 
				
			||||||
<p>Using post/index.tmpl</p>
 | 
					<p>Using posts/index.tmpl</p>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
{{ end }}
 | 
					{{ end }}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
templates/user/index.tmpl
 | 
					templates/users/index.tmpl
 | 
				
			||||||
```html
 | 
					```html
 | 
				
			||||||
{{ define "user/index.tmpl" }}
 | 
					{{ define "users/index.tmpl" }}
 | 
				
			||||||
<html><h1>
 | 
					<html><h1>
 | 
				
			||||||
	{{ .title }}
 | 
						{{ .title }}
 | 
				
			||||||
</h1>
 | 
					</h1>
 | 
				
			||||||
<p>Using user/index.tmpl</p>
 | 
					<p>Using users/index.tmpl</p>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
{{ end }}
 | 
					{{ end }}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user