mirror of https://github.com/gin-gonic/gin.git
Fix #191 outdated documentation
This commit is contained in:
parent
413d0f2296
commit
2d1291329a
|
@ -321,7 +321,7 @@ Using LoadHTMLTemplates()
|
||||||
```go
|
```go
|
||||||
func main() {
|
func main() {
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
r.LoadHTMLTemplates("templates/*")
|
r.LoadHTMLGlob("templates/*")
|
||||||
r.GET("/index", func(c *gin.Context) {
|
r.GET("/index", func(c *gin.Context) {
|
||||||
obj := gin.H{"title": "Main website"}
|
obj := gin.H{"title": "Main website"}
|
||||||
c.HTML(200, "index.tmpl", obj)
|
c.HTML(200, "index.tmpl", obj)
|
||||||
|
@ -331,6 +331,11 @@ func main() {
|
||||||
r.Run(":8080")
|
r.Run(":8080")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
```html
|
||||||
|
<h1>
|
||||||
|
{{ .title }}
|
||||||
|
</h1>
|
||||||
|
```
|
||||||
|
|
||||||
You can also use your own html template render
|
You can also use your own html template render
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue