What does HackerNews think of pongo2?

Django-syntax like template-engine for Go

Language: Go

#7 in Django
#58 in Go
#41 in Go
Yes, Go templating is quite hard. There was a feature request[1] to implement the Django/Jinja2-like Pongo2 template engine[2], but got rejected because it would have been a too big change.

[1]: https://github.com/gohugoio/hugo/issues/1359

[2]: https://github.com/flosch/pongo2

Yes, there is pongo2 [0] and my runner (basically a small Go software that runs the template engine) pongo2-runner [1].

I'm not the author of the library (pongo2), but I'm using pongo2-runner to dynamically create config files out of environment variables, with custom logic. Super recommended.

[0]: https://github.com/flosch/pongo2

[1]: https://github.com/swisscom/pongo2-runner

Working on a new project and part of it is web development, we're moving forward with some pain.

We use Fiber (https://gofiber.io) as web framework and Pongo2 (https://github.com/flosch/pongo2) as template engine. The Go/Fiber parts are ok, the pain is template engine.

- Pongo2 syntax is like Django/Jinja2, but not as easy as Jinja2. I use Python+Jinja2 for years in production, it's so easy to use and troubleshoot.

- No builtin i18n support. You can find some blog posts or articles introduce pongo2, but no one mentions i18n support/implementation like no one need it. We implemented our own i18n support, but still need a tool to extract strings from template files for translation.

- The macro syntax doesn't support specifying argument names while calling. e.g. `{{ my_macro("a", "b", "c") }}` is ok, but not `{{ my_macro(name1="a", name2="b", name3="c") }}`. It's hard to organize reusable HTML/CSS code snippets.

- Sometimes the custom macro is correct (syntax part), but it renders nothing in output html, but if i add the same pongo2 code in its own unittests files, it works. Didn't find a way to troubleshoot, no clue at all what the problem is.

Anyway, Go itself and the web framework are very good for web development now, just miss a Jinja2 for Go.

This Django style template library is also quite slick: https://github.com/flosch/pongo2