{"id":13393990,"url":"https://github.com/flosch/pongo2","last_synced_at":"2026-01-16T14:13:43.362Z","repository":{"id":10214981,"uuid":"12311467","full_name":"flosch/pongo2","owner":"flosch","description":"Django-syntax like template-engine for Go","archived":false,"fork":false,"pushed_at":"2026-01-11T22:30:38.000Z","size":684,"stargazers_count":3016,"open_issues_count":69,"forks_count":280,"subscribers_count":65,"default_branch":"master","last_synced_at":"2026-01-12T00:03:45.211Z","etag":null,"topics":["django","go","golang","golang-library","pongo2","template","template-engine","template-language","templates"],"latest_commit_sha":null,"homepage":"https://www.schlachter.tech/pongo2","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flosch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["flosch"]}},"created_at":"2013-08-23T01:00:08.000Z","updated_at":"2026-01-11T22:30:42.000Z","dependencies_parsed_at":"2023-12-15T10:05:51.192Z","dependency_job_id":"bb802372-7fc5-4aea-bc02-15da28457aa6","html_url":"https://github.com/flosch/pongo2","commit_stats":{"total_commits":491,"total_committers":56,"mean_commits":8.767857142857142,"dds":"0.18329938900203668","last_synced_commit":"c84aecb5fa79a9c0feec284a7bf4f0536c6a6e99"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/flosch/pongo2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flosch%2Fpongo2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flosch%2Fpongo2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flosch%2Fpongo2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flosch%2Fpongo2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flosch","download_url":"https://codeload.github.com/flosch/pongo2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flosch%2Fpongo2/sbom","scorecard":{"id":404122,"data":{"date":"2025-08-11","repo":{"name":"github.com/flosch/pongo2","commit":"c84aecb5fa79a9c0feec284a7bf4f0536c6a6e99"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.6,"checks":[{"name":"Security-Policy","score":9,"reason":"security policy file detected","details":["Info: security policy file detected: SECURITY.md:1","Info: Found linked content: SECURITY.md:1","Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy","Info: Found text in security policy: SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/flosch/pongo2/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/flosch/pongo2/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/flosch/pongo2/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/flosch/pongo2/codeql-analysis.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":10,"reason":"project is fuzzed","details":["Info: GoBuiltInFuzzer integration found: filters_builtin_test.go:21","Info: GoBuiltInFuzzer integration found: pongo2_test.go:131"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T20:46:53.289Z","repository_id":10214981,"created_at":"2025-08-18T20:46:53.289Z","updated_at":"2025-08-18T20:46:53.289Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","go","golang","golang-library","pongo2","template","template-engine","template-language","templates"],"created_at":"2024-07-30T17:01:04.857Z","updated_at":"2026-01-16T14:13:43.356Z","avatar_url":"https://github.com/flosch.png","language":"Go","readme":"# [pongo](https://en.wikipedia.org/wiki/Pongo_%28genus%29)2\n\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/flosch/pongo2)](https://pkg.go.dev/github.com/flosch/pongo2)\n[![Build Status](https://schlachterinf.semaphoreci.com/badges/pongo2/branches/master.svg?style=shields\u0026key=4ecde757-d6dd-4db2-8998-c84f55253d8f)](https://schlachterinf.semaphoreci.com/projects/pongo2)\n[![Run on Repl.it](https://repl.it/badge/github/flosch/pongo2)](https://repl.it/github/flosch/pongo2)\n\npongo2 is a Django-syntax like templating-language ([official website](https://www.schlachter.tech/solutions/pongo2-template-engine/)).\n\nInstall/update using `go get` (no dependencies required by pongo2):\n\n```sh\ngo get -u github.com/flosch/pongo2/v7\n```\n\nPlease use the [issue tracker](https://github.com/flosch/pongo2/issues) if you're encountering any problems with pongo2 or if you need help with implementing tags or filters ([create a ticket!](https://github.com/flosch/pongo2/issues/new)).\n\n:question: [**Looking for a Go developer/consultant?** I'm available for hire. :man_technologist:](mailto:florian@schlachter.tech )\n\n## First impression of a template\n\n```django\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eOur admins and users\u003c/title\u003e\n  \u003c/head\u003e\n  {# This is a short example to give you a quick overview of pongo2's syntax. #}\n  {% macro user_details(user, is_admin=false) %}\n  \u003cdiv class=\"user_item\"\u003e\n    \u003c!-- Let's indicate a user's good karma --\u003e\n    \u003ch2 {% if (user.karma\u003e= 40) || (user.karma \u003e calc_avg_karma(userlist)+5) %} class=\"karma-good\"{% endif %}\u003e\n\n      \u003c!-- This will call user.String() automatically if available: --\u003e\n      {{ user }}\n    \u003c/h2\u003e\n\n    \u003c!-- Will print a human-readable time duration like \"3 weeks ago\" --\u003e\n    \u003cp\u003eThis user registered {{ user.register_date|naturaltime }}.\u003c/p\u003e\n\n    \u003c!-- Let's allow the users to write down their biography using markdown;\n             we will only show the first 15 words as a preview --\u003e\n    \u003cp\u003eThe user's biography:\u003c/p\u003e\n    \u003cp\u003e\n      {{ user.biography|markdown|truncatewords_html:15 }}\n      \u003ca href=\"/user/{{ user.id }}/\"\u003eread more\u003c/a\u003e\n    \u003c/p\u003e\n\n    {% if is_admin %}\n    \u003cp\u003eThis user is an admin!\u003c/p\u003e\n    {% endif %}\n  \u003c/div\u003e\n  {% endmacro %}\n\n  \u003cbody\u003e\n    \u003c!-- Make use of the macro defined above to avoid repetitive HTML code\n         since we want to use the same code for admins AND members --\u003e\n\n    \u003ch1\u003eOur admins\u003c/h1\u003e\n    {% for admin in adminlist %} {{ user_details(admin, true) }} {% endfor %}\n\n    \u003ch1\u003eOur members\u003c/h1\u003e\n    {% for user in userlist %} {{ user_details(user) }} {% endfor %}\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Documentation\n\n- [Getting Started](docs/getting-started.md) - Installation, basic usage, and first steps\n- [Template Syntax](docs/template-syntax.md) - Variables, expressions, operators, and comments\n- [Filters Reference](docs/filters.md) - Complete list of all built-in filters\n- [Tags Reference](docs/tags.md) - Complete list of all built-in tags\n- [Macros](docs/macros.md) - Reusable template fragments with arguments\n- [Template Sets](docs/template-sets.md) - Loaders, caching, globals, and sandbox features\n- [Security and Sandboxing](docs/security-sandboxing.md) - Autoescape, sandboxing, and security best practices\n- [Custom Extensions](docs/custom-extensions.md) - Creating your own filters and tags\n- [Changelog](CHANGELOG.md) - Version history and release notes\n\n## Features\n\n- Syntax- and feature-set-compatible with [Django templates](https://docs.djangoproject.com/en/stable/topics/templates/)\n- [Advanced C-like expressions](https://github.com/flosch/pongo2/blob/master/template_tests/expressions.tpl).\n- [Complex function calls within expressions](https://github.com/flosch/pongo2/blob/master/template_tests/function_calls_wrapper.tpl).\n- [Easy API to create new filters and tags](http://godoc.org/github.com/flosch/pongo2#RegisterFilter) ([including parsing arguments](http://godoc.org/github.com/flosch/pongo2#Parser))\n- Additional features:\n  - Macros including importing macros from other files (see [template_tests/macro.tpl](https://github.com/flosch/pongo2/blob/master/template_tests/macro.tpl))\n  - [Template sandboxing](https://godoc.org/github.com/flosch/pongo2#TemplateSet) ([directory patterns](http://golang.org/pkg/path/filepath/#Match), banned tags/filters)\n\n## Caveats\n\n### Filters\n\n- **date** / **time**: The `date` and `time` filter are taking the Golang specific time- and date-format (not Django's one) currently. [Take a look on the format here](http://golang.org/pkg/time/#Time.Format).\n- **stringformat**: `stringformat` does **not** take Python's string format syntax as a parameter, instead it takes Go's. Essentially `{{ 3.14|stringformat:\"pi is %.2f\" }}` is `fmt.Sprintf(\"pi is %.2f\", 3.14)`.\n- **escape** / **force_escape**: Unlike Django's behaviour, the `escape`-filter is applied immediately. Therefore there is no need for a `force_escape`-filter yet.\n\n### Tags\n\n- **for**: All the `forloop` fields (like `forloop.counter`) are written with a capital letter at the beginning. For example, the `counter` can be accessed by `forloop.Counter` and the parentloop by `forloop.Parentloop`.\n- **now**: takes Go's time format (see **date** and **time**-filter).\n\n### Misc\n\n- **not in-operator**: You can check whether a map/struct/string contains a key/field/substring by using the in-operator (or the negation of it):\n  `{% if key in map %}Key is in map{% else %}Key not in map{% endif %}` or `{% if !(key in map) %}Key is NOT in map{% else %}Key is in map{% endif %}`.\n\n## Add-ons, libraries and helpers\n\n### Official\n\n- [pongo2-addons](https://github.com/flosch/pongo2-addons) - Official additional filters/tags for pongo2 (for example a **markdown**-filter). They are in their own repository because they're relying on 3rd-party-libraries.\n\n### 3rd-party\n\n- [beego-pongo2](https://github.com/oal/beego-pongo2) - A tiny little helper for using Pongo2 with [Beego](https://github.com/astaxie/beego).\n- [beego-pongo2.v2](https://github.com/ipfans/beego-pongo2.v2) - Same as `beego-pongo2`, but for pongo2 v2.\n- [macaron-pongo2](https://github.com/macaron-contrib/pongo2) - pongo2 support for [Macaron](https://github.com/Unknwon/macaron), a modular web framework.\n- [ginpongo2](https://github.com/ngerakines/ginpongo2) - middleware for [gin](github.com/gin-gonic/gin) to use pongo2 templates\n- [Build'n support for Iris' template engine](https://github.com/kataras/iris)\n- [pongo2gin](https://gitlab.com/go-box/pongo2gin) - alternative renderer for [gin](github.com/gin-gonic/gin) to use pongo2 templates\n- [pongo2-trans](https://github.com/digitalcrab/pongo2trans) - `trans`-tag implementation for internationalization\n- [tpongo2](https://github.com/tango-contrib/tpongo2) - pongo2 support for [Tango](https://github.com/lunny/tango), a micro-kernel \u0026 pluggable web framework.\n- [p2cli](https://github.com/wrouesnel/p2cli) - command line templating utility based on pongo2\n- [pongorenderer](https://github.com/siredwin/pongorenderer) - minimal pongo2 renderer for [Echo](https://github.com/labstack/echo) web framework\n- [pongo2gcloud](https://github.com/dieselburner/pongo2gcloud) - Google Cloud Storage loader for pongo2 template files\n\nPlease add your project to this list and send me a pull request when you've developed something nice for pongo2.\n\n## Who's using pongo2\n\n[I'm compiling a list of pongo2 users](https://github.com/flosch/pongo2/issues/241). Add your project or company!\n\n## API-usage examples\n\nPlease see the documentation for a full list of provided API methods.\n\n### A tiny example (template string)\n\n```go\n// Compile the template first (i. e. creating the AST)\ntpl, err := pongo2.FromString(\"Hello {{ name|capfirst }}!\")\nif err != nil {\n    panic(err)\n}\n// Now you can render the template with the given\n// pongo2.Context how often you want to.\nout, err := tpl.Execute(pongo2.Context{\"name\": \"florian\"})\nif err != nil {\n    panic(err)\n}\nfmt.Println(out) // Output: Hello Florian!\n```\n\n## Example server-usage (template file)\n\n```go\npackage main\n\nimport (\n    \"github.com/flosch/pongo2/v7\"\n    \"net/http\"\n)\n\n// Pre-compiling the templates at application startup using the\n// little Must()-helper function (Must() will panic if FromFile()\n// or FromString() will return with an error - that's it).\n// It's faster to pre-compile it anywhere at startup and only\n// execute the template later.\nvar tplExample = pongo2.Must(pongo2.FromFile(\"example.html\"))\n\nfunc examplePage(w http.ResponseWriter, r *http.Request) {\n    // Execute the template per HTTP request\n    err := tplExample.ExecuteWriter(pongo2.Context{\"query\": r.FormValue(\"query\")}, w)\n    if err != nil {\n        http.Error(w, err.Error(), http.StatusInternalServerError)\n    }\n}\n\nfunc main() {\n    http.HandleFunc(\"/\", examplePage)\n    http.ListenAndServe(\":8080\", nil)\n}\n```\n","funding_links":["https://github.com/sponsors/flosch"],"categories":["Template Engines","Misc","开源类库","Go","HTML template engines","Open source library","模板引擎","Repositories","模板引擎`模版渲染和模版生成处理库`","Relational Databases","\u003cspan id=\"模板引擎-template-engines\"\u003e模板引擎 Template Engines\u003c/span\u003e"],"sub_categories":["HTTP Clients","模板引擎","Template Engine","Advanced Console UIs","查询语","交互工具","HTTP客户端","交流","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflosch%2Fpongo2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflosch%2Fpongo2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflosch%2Fpongo2/lists"}