Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 8, 2024
1 parent efb0a86 commit 8eb8d2c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 7 deletions.
14 changes: 14 additions & 0 deletions template_versioned_docs/version-html_v2.x.x/django/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,17 @@ Hello, World!<br /><br />Greetings from Fiber Team
</body>
</html>
```

### Important Information on Template Data Binding

When working with Pongo2 and this template engine, it's crucial to understand the specific rules for data binding. Only keys that match the following regular expression are supported: `^[a-zA-Z0-9_]+$`.

This means that keys with special characters or punctuation, such as `my-key` or `my.key`, are not compatible and will not be bound to the template. This is a restriction imposed by the underlying Pongo2 template engine. Please ensure your keys adhere to these rules to avoid any binding issues.

If you need to access a value in the template that doesn't adhere to the key naming restrictions imposed by the Pongo2 template engine, you can bind the value to a new field when calling `fiber.Render`. Here's an example:

```go
c.Render("index", fiber.Map{
"Fiber": "Hello, World!\n\nGreetings from Fiber Team",
"MyKey": c.Locals("my-key"),
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: handlebars
title: Handlebars
---

![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=django*)
![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=handlebars*)
[![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7)](https://gofiber.io/discord)
![Test](https://github.com/gofiber/template/workflows/Tests/badge.svg)
![Security](https://github.com/gofiber/template/workflows/Security/badge.svg)
Expand Down
9 changes: 8 additions & 1 deletion template_versioned_docs/version-html_v2.x.x/html/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: html
title: HTML
---

![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=django*)
![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=html*)
[![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7)](https://gofiber.io/discord)
![Test](https://github.com/gofiber/template/workflows/Tests/badge.svg)
![Security](https://github.com/gofiber/template/workflows/Security/badge.svg)
Expand Down Expand Up @@ -93,6 +93,13 @@ func main() {
}, "layouts/main")
})

app.Get("/layouts-nested", func(c *fiber.Ctx) error {
// Render index within layouts/nested/main within layouts/nested/base
return c.Render("index", fiber.Map{
"Title": "Hello, World!",
}, "layouts/nested/main", "layouts/nested/base")
})

log.Fatal(app.Listen(":3000"))
}

Expand Down
2 changes: 1 addition & 1 deletion template_versioned_docs/version-html_v2.x.x/jet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: jet
title: Jet
---

![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=django*)
![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=jet*)
[![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7)](https://gofiber.io/discord)
![Test](https://github.com/gofiber/template/workflows/Tests/badge.svg)
![Security](https://github.com/gofiber/template/workflows/Security/badge.svg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: mustache
title: Mustache
---

![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=django*)
![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=mustache*)
[![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7)](https://gofiber.io/discord)
![Test](https://github.com/gofiber/template/workflows/Tests/badge.svg)
![Security](https://github.com/gofiber/template/workflows/Security/badge.svg)
Expand Down
4 changes: 2 additions & 2 deletions template_versioned_docs/version-html_v2.x.x/pug/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: pug
title: Pug
---

![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=django*)
![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=pug*)
[![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7)](https://gofiber.io/discord)
![Test](https://github.com/gofiber/template/workflows/Tests/badge.svg)
![Security](https://github.com/gofiber/template/workflows/Security/badge.svg)
Expand Down Expand Up @@ -58,7 +58,7 @@ func main() {

// Or from an embedded system
// See github.com/gofiber/embed for examples
// engine := pug.NewFileSystem(http.Dir("./views", ".pug"))
// engine := pug.NewFileSystem(http.Dir("./views"), ".pug")

// Pass the engine to the views
app := fiber.New(fiber.Config{
Expand Down
2 changes: 1 addition & 1 deletion template_versioned_docs/version-html_v2.x.x/slim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: slim
title: Slim
---

![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=django*)
![Release](https://img.shields.io/github/v/tag/gofiber/template?filter=slim*)
[![Discord](https://img.shields.io/discord/704680098577514527?style=flat&label=%F0%9F%92%AC%20discord&color=00ACD7)](https://gofiber.io/discord)
![Test](https://github.com/gofiber/template/workflows/Tests/badge.svg)
![Security](https://github.com/gofiber/template/workflows/Security/badge.svg)
Expand Down

0 comments on commit 8eb8d2c

Please sign in to comment.