{"id":17275105,"url":"https://github.com/daun/statamic-latte","last_synced_at":"2025-04-14T09:11:40.991Z","repository":{"id":226962386,"uuid":"769702046","full_name":"daun/statamic-latte","owner":"daun","description":"Use Latte templates on Statamic sites","archived":false,"fork":false,"pushed_at":"2025-03-06T19:41:35.000Z","size":175,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T09:11:28.499Z","etag":null,"topics":["latte","statamic","statamic-addon","templates","views"],"latest_commit_sha":null,"homepage":"https://statamic.com/addons/daun/latte","language":"PHP","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/daun.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2024-03-09T20:14:56.000Z","updated_at":"2025-03-06T19:41:38.000Z","dependencies_parsed_at":"2024-04-29T14:49:12.482Z","dependency_job_id":null,"html_url":"https://github.com/daun/statamic-latte","commit_stats":null,"previous_names":["daun/statamic-latte"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fstatamic-latte","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fstatamic-latte/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fstatamic-latte/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fstatamic-latte/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daun","download_url":"https://codeload.github.com/daun/statamic-latte/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248852181,"owners_count":21171842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["latte","statamic","statamic-addon","templates","views"],"created_at":"2024-10-15T08:55:27.061Z","updated_at":"2025-04-14T09:11:40.519Z","avatar_url":"https://github.com/daun.png","language":"PHP","readme":"# Statamic Latte\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/daun/statamic-latte.svg)](https://packagist.org/packages/daun/statamic-latte)\n[![Test Status](https://img.shields.io/github/actions/workflow/status/daun/statamic-latte/ci.yml?label=tests)](https://github.com/daun/statamic-latte/actions/workflows/ci.yml)\n[![Code Coverage](https://img.shields.io/codecov/c/github/daun/statamic-latte)](https://app.codecov.io/gh/daun/statamic-latte)\n[![License](https://img.shields.io/github/license/daun/statamic-latte.svg)](https://github.com/daun/statamic-latte/blob/master/LICENSE)\n\nUse the [Latte](https://latte.nette.org/en/) templating language on [Statamic](https://statamic.com/) sites.\n\n## ✨ Features\n\n- Render `.latte` views\n- Use Statamic's built-in tags and modifiers\n- Resolve the current layout from entry data\n- Render Antlers inline where useful\n\n## 🛠️ Installation\n\nRun the following command from your project root:\n\n```sh\ncomposer require daun/statamic-latte\n```\n\nAlternatively, you can search for this addon in the `Tools \u003e Addons` section of\nthe Statamic control panel and install it from there.\n\n## 🎨 Usage\n\nOnce installed, you're ready to use Latte views in your frontend. Just save or rename your views\nusing the extension `.latte` and reference them as usual. Of course, you can use both side-by-side\nas long as you're making sure there's only ever one identically named view.\n\n```diff\n- /resources/views/project.antlers.html\n+ /resources/views/project.latte\n```\n\n**Antlers**\n\n```antlers\n\u003cul\u003e\n    {{ songs }}\n        \u003cli\u003e{{ value }} (Next: {{ next:value }})\u003c/li\u003e\n    {{ /songs }}\n\u003c/ul\u003e\n```\n\n**Latte**\n\n```latte\n\u003cul n:inner-foreach=\"$songs as $song\"\u003e\n    \u003cli\u003e{$song} (Next: {$iterator-\u003enextValue})\u003c/li\u003e\n\u003c/ul\u003e\n```\n\n### Tags\n\n[Statamic Tags](https://statamic.dev/tags) can be used via the `s` helper function:\n\n**Antlers**\n\n```antlers\n{{ collection:pages take=\"8\" }}\n  {{ title }}\n{{ /collection }}\n```\n\n**Latte**\n\n```latte\n{foreach s('collection:pages', take: 8) as $entry}\n  {$entry-\u003etitle}\n{/foreach}\n```\n\n### Modifiers\n\n[Statamic Modifiers](https://statamic.dev/modifiers) can also be used as filters in Latte:\n\n**Antlers**\n\n```antlers\n\u003ch1\u003e{{ title | upper | truncate(50) }}\u003c/h1\u003e\n```\n\n**Latte**\n\n```latte\n\u003ch1\u003e{$title|upper|truncate:50}\u003c/h1\u003e\n```\n\n### Mix \u0026 Match\n\nIf you ever need to combine Latte and Antlers code, you can use the `antlers` tag in your\nLatte views to render Antlers code inline. This can be useful for complex built-in tags or quick\nprototyping by copy-pasting examples from the docs.\n\n```latte\nRendered in Latte: {$title}\n\n{antlers}\n    Rendered in Antlers: {{ title }}\n{/antlers}\n```\n\n### Layout\n\nJust like in Antlers templates, the correct layout file will be used based on the data available in\nyour entries and blueprints.\n\nBy default, it will look for `/resources/views/layout.latte`, but you can configure specific entries\nand collections to use different layouts instead by setting `layout: other_layout` on the entry or\ncollection config file.\n\n### Caching\n\n#### Cache\n\nUse the `cache` tag to cache parts of a view.\n\n```latte\n{cache for: '10 minutes'}\n    {foreach $stocks as $stock}\n        {$stock-\u003efetchPrice()}\n    {/foreach}\n{/cache}\n```\n\n#### Nocache\n\nThe `nocache` tag can be used to exempt part of a view from\n[static caching](https://statamic.dev/static-caching).\n\n```latte\n{include 'partials.nav', handle: main}\n \n{nocache} \n    {if $logged_in}\n        Welcome back, {$current_user-\u003ename}\n    {else}\n        Hello, Guest!\n    {/if}\n{/nocache}\n \n{block content}{/block}\n```\n\n#### Limitations\n\nThe `nocache` tag is only supported for application-level static caching. Full file-based caching\nrequires JavaScript for `nocache` to work, which isn't yet implemented in this addon. See\n[Caching Strategies](https://statamic.dev/static-caching#caching-strategies) for details.\n\nNesting `cache` and `nocache` is also not yet supported. The following **will not work**:\n\n```latte\n{cache}\n    this will be cached\n    {nocache}\n        this will remain dynamic\n    {/nocache}\n    this will also be cached\n{/cache}\n```\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaun%2Fstatamic-latte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaun%2Fstatamic-latte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaun%2Fstatamic-latte/lists"}