mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-22 15:24:38 +00:00
Update template examples
This commit is contained in:
parent
f50c33debf
commit
071746964a
16
.github/README.md
vendored
16
.github/README.md
vendored
@ -233,17 +233,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -252,13 +252,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_ar_SA.md
vendored
16
.github/README_ar_SA.md
vendored
@ -260,17 +260,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 إظهار المزيد من أمثلة التعليمات البرمجية</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
|
||||
<div dir="ltr" >
|
||||
@ -282,13 +282,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_de.md
vendored
16
.github/README_de.md
vendored
@ -229,17 +229,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -248,13 +248,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_es.md
vendored
16
.github/README_es.md
vendored
@ -229,17 +229,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Mostrar más ejemplos de código</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -248,13 +248,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_fr.md
vendored
16
.github/README_fr.md
vendored
@ -229,17 +229,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -248,13 +248,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_he.md
vendored
16
.github/README_he.md
vendored
@ -303,17 +303,17 @@ func main() {
|
||||
<summary>📚 הצג דוגמאות קוד נוספות</summary>
|
||||
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
<div dir="ltr">
|
||||
|
||||
@ -324,13 +324,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_id.md
vendored
16
.github/README_id.md
vendored
@ -231,17 +231,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -250,13 +250,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_ja.md
vendored
16
.github/README_ja.md
vendored
@ -232,17 +232,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -251,13 +251,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_ko.md
vendored
16
.github/README_ko.md
vendored
@ -234,17 +234,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -253,13 +253,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_nl.md
vendored
16
.github/README_nl.md
vendored
@ -233,17 +233,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -252,13 +252,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_pt.md
vendored
16
.github/README_pt.md
vendored
@ -229,17 +229,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -248,13 +248,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_ru.md
vendored
16
.github/README_ru.md
vendored
@ -231,17 +231,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Показать больше примеров кода</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -250,13 +250,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_tr.md
vendored
16
.github/README_tr.md
vendored
@ -229,17 +229,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Daha fazla kod örneği göster</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -248,13 +248,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
16
.github/README_zh-CN.md
vendored
16
.github/README_zh-CN.md
vendored
@ -232,17 +232,17 @@ func main() {
|
||||
<details>
|
||||
<summary>📚 Show more code examples</summary>
|
||||
|
||||
### Template engines
|
||||
### Views engines
|
||||
|
||||
📖 [Settings](https://docs.gofiber.io/application#settings)
|
||||
📖 [Template Engines](https://github.com/gofiber/template)
|
||||
📖 [Engines](https://github.com/gofiber/template)
|
||||
📖 [Render](https://docs.gofiber.io/context#render)
|
||||
|
||||
Fiber defaults to the [Go template engine](https://golang.org/pkg/html/template/) when no Template engine is set.
|
||||
Fiber defaults to the [html/template](https://golang.org/pkg/html/template/) when no view engine is set.
|
||||
|
||||
If you want to template partials and a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
If you want to execute partials or use a different engine like [amber](https://github.com/eknkc/amber), [handlebars](https://github.com/aymerick/raymond), [mustache](https://github.com/cbroglie/mustache) or [pug](https://github.com/Joker/jade) etc..
|
||||
|
||||
You can use our [Template Middleware](https://github.com/gofiber/template).
|
||||
Checkout our [Template](https://github.com/gofiber/template) package that support multiple view engines.
|
||||
|
||||
```go
|
||||
import (
|
||||
@ -251,13 +251,13 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// You can setup template engine before initiation app:
|
||||
// You can setup Views engine before initiation app:
|
||||
app := fiber.New(&fiber.Settings{
|
||||
Templates: pug.New("./views", ".pug"),
|
||||
Views: pug.New("./views", ".pug"),
|
||||
})
|
||||
|
||||
// OR after initiation app at any convenient location:
|
||||
app.Settings.Templates = pug.New("./views", ".pug"),
|
||||
app.Settings.Views = pug.New("./views", ".pug"),
|
||||
|
||||
// And now, you can call template `./views/home.pug` like this:
|
||||
app.Get("/", func(c *fiber.Ctx) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user