{"id":36495911,"url":"https://github.com/apisite/apitpl","last_synced_at":"2026-01-20T16:37:24.062Z","repository":{"id":57510778,"uuid":"176156863","full_name":"apisite/apitpl","owner":"apisite","description":"Golang templates for API sites","archived":false,"fork":false,"pushed_at":"2025-12-16T07:24:43.000Z","size":190,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-15T07:22:46.617Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/apisite/apitpl","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/apisite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-03-17T20:29:29.000Z","updated_at":"2025-12-16T07:24:46.000Z","dependencies_parsed_at":"2023-07-14T22:53:58.367Z","dependency_job_id":null,"html_url":"https://github.com/apisite/apitpl","commit_stats":null,"previous_names":["apisite/tpl2x"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/apisite/apitpl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apisite%2Fapitpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apisite%2Fapitpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apisite%2Fapitpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apisite%2Fapitpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apisite","download_url":"https://codeload.github.com/apisite/apitpl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apisite%2Fapitpl/sbom","scorecard":{"id":202840,"data":{"date":"2025-08-11","repo":{"name":"github.com/apisite/apitpl","commit":"60cd7ed80e3862ce28cdb1bda77d4a77daa1b8fb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test_and_cov.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":"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":"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 0/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":"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/test_and_cov.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/apisite/apitpl/test_and_cov.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test_and_cov.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/apisite/apitpl/test_and_cov.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test_and_cov.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/apisite/apitpl/test_and_cov.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party 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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"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":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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":0,"reason":"11 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2023-2402 / GHSA-45x7-px36-x8w8","Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2023-1988 / GHSA-2wrh-6pvc-2jm9","Warn: Project is vulnerable to: GO-2023-2102 / GHSA-4374-p667-p6c8","Warn: Project is vulnerable to: GHSA-qppj-fm5r-hxr3","Warn: Project is vulnerable to: GO-2024-2687 / GHSA-4v7x-pqxf-cx7m","Warn: Project is vulnerable to: GO-2024-3333","Warn: Project is vulnerable to: GO-2025-3503 / GHSA-qxp5-gwg8-xv66","Warn: Project is vulnerable to: GO-2025-3595 / GHSA-vvgc-356p-c3xw","Warn: Project is vulnerable to: GO-2024-2611 / GHSA-8r3f-844c-mc37"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T23:07:19.383Z","repository_id":57510778,"created_at":"2025-08-16T23:07:19.383Z","updated_at":"2025-08-16T23:07:19.383Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28481910,"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":[],"created_at":"2026-01-12T02:01:04.567Z","updated_at":"2026-01-16T19:38:29.235Z","avatar_url":"https://github.com/apisite.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cspan\u003eEnglish\u003c/span\u003e |\n  \u003ca href=\"README.ru.md#apisiteapitpl\"\u003ePусский\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n# apisite/apitpl\n\u003e golang template engine which renders templates by executing them 2 times, one for content and another one for layout\n\n[![GoDoc][gd1]][gd2]\n [![codecov][cc1]][cc2]\n [![GoCard][gc1]][gc2]\n [![GitHub Release][gr1]][gr2]\n [![LoC][loc1]][loc2]\n [![GitHub code size in bytes][sz]]()\n [![GitHub license][gl1]][gl2]\n\n[cc1]: https://codecov.io/gh/apisite/apitpl/branch/master/graph/badge.svg\n[cc2]: https://codecov.io/gh/apisite/apitpl\n[gd1]: https://pkg.go.dev/badge/github.com/apisite/apitpl\n[gd2]: https://pkg.go.dev/github.com/apisite/apitpl?\n[gc1]: https://goreportcard.com/badge/github.com/apisite/apitpl\n[gc2]: https://goreportcard.com/report/github.com/apisite/apitpl\n[gr1]: https://img.shields.io/github/release-pre/apisite/apitpl.svg\n[gr2]: https://github.com/apisite/apitpl/releases\n[sz]: https://img.shields.io/github/languages/code-size/apisite/apitpl.svg\n[loc1]: .loc.svg \"Lines of Code\"\n[loc2]: LOC.md\n[gl1]: https://img.shields.io/github/license/apisite/apitpl.svg\n[gl2]: LICENSE\n\n* Project status: MVP is ready\n* Future plans: tests \u0026 docs\n\nThis package offers 2-step template processing, where page content template called first, so it can\n1. change page layout (among them previous markup) and content type\n2. abort processing and return error page (this will render layout with error and without content)\n3. abort processing and return redirect\n\nIf page content template returns HTML, at step 2, layout template will be called for result page markup build.\n\n## Why do we need another template engine?\n\n1. Adding template file without source recompiling\n2. Support plain HTML body as template (adding layout without additional markup in content)\n3. Attach all (pages,layouts,includes) templates at start (see lookupfs)\n4. Auto create routes for all page templates allowing them get required data via api (see ginapitpl)\n\n## Request processing flow\n\n![Request processing flow](flow.png)\n\n## Template structure\n\nAs shown in [testdata](tree/master/testdata), site templates tree might looks like:\n\n```\ntmpl\n├── includes\n│   ├── inc.html\n│   └── subdir1\n│       └── inc.html\n├── layouts\n│   ├── default.html\n│   └── subdir2\n│       └── lay.html\n└── pages\n    ├── page.html\n    └── subdir3\n        └── page.html\n```\n\n## Usage\n\n### Template parsing\n\nAll templates from the `Root` directory tree are parsed in `Parse()` call and program should be aborted on error.\nRoutes for all page URI should be set in `Route()` call after that.\n\nYou can enable per request templates parsing for debugging purposes via `ParseAlways(true)` but you still have to restart your program for adding or removing any template file.\n\n### See also\n* [Package examples](https://pkg.go.dev/github.com/apisite/apitpl#pkg-examples)\n* [ginapitpl](https://pkg.go.dev/github.com/apisite/apitpl/ginapitpl) - [gin](https://github.com/gin-gonic/gin) bindings for this package\n\n### Template methods\nGet http.Request data\n```\n{{ request.Host }}{{ request.URL.String | HTML }}\n```\nGet query params\n```\n{{ $param := .Request.URL.Query.Get \"param\" -}}\n```\nSet page title\n```\n{{ .SetTitle \"admin:index\" -}}\n```\nChoose layout\n```\n{{ .SetLayout \"wide\" -}}\n```\nStop template processing and raise error\n```\n{{ .Raise 403 true \"Error description\" }}\n```\nStop template processing and return redirect \n```\n{{ .RedirectFound \"/page\" }}\n```\n\n### Custom methods\nin code\n```go\nreqFuncs[\"data\"] = func() interface{} {\n    return data\n}\np, err := mlt.RenderPage(uri, reqFuncs, r)\n```\nin templates\n```\n{{range data.Todos -}}\n    \u003cli\u003e{{- .Title }}\n{{end -}}\n\n```\n\n## See also\n\n* https://stackoverflow.com/questions/42747183/how-to-render-templates-to-multiple-layouts-in-go\n* https://medium.com/@leeprovoost/dealing-with-go-template-errors-at-runtime-1b429e8b854a\n\n## License\n\nThe MIT License (MIT), see [LICENSE](LICENSE).\n\nCopyright (c) 2018 Aleksei Kovrizhkin \u003clekovr+apisite@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapisite%2Fapitpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapisite%2Fapitpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapisite%2Fapitpl/lists"}