{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "Cecil - Templates",
  "home_page_url": "https://cloudflare.cecil.app/documentation/templates/",
  "feed_url": "https://cloudflare.cecil.app/documentation/templates/feed.json",
  "description": "Work with Twig layouts, templates and components.",
  "icon": "https://cloudflare.cecil.app/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "favicon": "https://cloudflare.cecil.app/thumbnails/64x/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "language": "en",
  "items": [
    {
      "id": "https://cloudflare.cecil.app/documentation/templates/lookup-rules/",
      "url": "https://cloudflare.cecil.app/documentation/templates/lookup-rules/",
      "title": "Organization and lookup rules",
      "summary": "Kinds of templates, naming convention, built-in templates and how a template is chosen for a page.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Organization and lookup rules\nCecil renders pages with Twig templates: this page explains how templates are organized and how the right one is chosen for each page.\nFiles organization\nKinds of templates\nThere are three kinds of templates: layouts, components, and other templates. Layouts are used to render pages, and each layout can include templates and components.\nNaming convention\nTemplate files are stored in the layouts\/ directory and must be named according to the following convention:\nlayouts\/(&lt;section&gt;\/)&lt;type&gt;|&lt;layout&gt;.&lt;format&gt;(.&lt;language&gt;).twig\n\n&lt;section&gt; (optional)\nThe section of the page (e.g.: blog).\n&lt;type&gt;\nThe template type: home (or index) for the homepage, list for list pages (homepage and sections), page for a page, etc. (See Lookup rules for details).\n&lt;layout&gt; (optional)\nThe custom layout name defined in the front matter of the page (e.g.: layout: my-layout).\n&lt;format&gt;\nThe output format of the rendered page (e.g.: html, rss, json, xml, etc.).\n&lt;language&gt; (optional)\nThe language of the page (e.g.: fr).\n\nExamples:\nlayouts\/home.html.twig       # `type` is \"homepage\"\nlayouts\/page.html.twig       # `type` is \"page\"\nlayouts\/page.html.fr.twig    # `type` is \"page\" and `language` is \"fr\"\nlayouts\/my-layout.html.twig  # `layout` is \"my-layout\"\nlayouts\/blog\/list.html.twig  # `section` is \"blog\"\nlayouts\/blog\/list.rss.twig   # `section` is \"blog\" and `format` is \"rss\"\n&lt;my-site&gt;\n├─ ...\n├─ layouts\n|  ├─ index.html.twig      # Used by type \"homepage\"\n|  ├─ list.html.twig       # Used by types \"homepage\" and \"section\"\n|  ├─ list.rss.twig        # Used by types \"homepage\" and \"section\", for RSS output format\n|  ├─ page.html.twig       # Used by type \"page\"\n|  ├─ taxonomy\n|  |  ├─ tags.html.twig    # Used by type \"vocabulary\" of `tags` (list of terms)\n|  |  └─ tag.html.twig     # Used by type \"term\" of `tags` (list of pages)\n|  ├─ my-layout.html.twig  # Used by pages with `layout: my-layout` in the front matter\n|  ├─ ...\n|  └─ partials             # Included templates\n|     ├─ footer.html.twig\n|     └─ ...\n└─ themes                  # Themes layouts and templates\n   └─ ...\nBuilt-in templates\nCecil comes with a set of built-in templates.\nIf you need to modify built-in templates, you can easily extract them via the following command: they will be copied into the layouts directory of your site.\nphp cecil.phar util:templates:extract\nLookup rules\nIn most cases you don’t need to specify the layout: Cecil selects the most appropriate layout, according to the page type.\nFor example, the HTML output of the home page (index.md) will be rendered:\n\nwith my-layout.html.twig if the layout variable is set to \"my-layout\" (in the front matter)\nif not, with index.html.twig if the file exists\nif not, with home.html.twig if the file exists\nif not, with list.html.twig if the file exists\n\nAll rules are detailed below, for each page type, in the priority order.\nEach candidate template is searched in the layouts\/ directory of the site, then in the layouts\/ directory of each theme (in the configured order), then in the built-in templates. The first file found is used.\nFor a page in a language other than the default one, the localized variant of each candidate (e.g.: page.html.fr.twig) is tried first: all localized candidates are looked up before the non-localized ones.\nType homepage\n\n&lt;layout&gt;.&lt;format&gt;.twig\nindex.&lt;format&gt;.twig\nhome.&lt;format&gt;.twig\nlist.&lt;format&gt;.twig\n_default\/&lt;layout&gt;.&lt;format&gt;.twig\n_default\/index.&lt;format&gt;.twig\n_default\/home.&lt;format&gt;.twig\n_default\/list.&lt;format&gt;.twig\n_default\/page.&lt;format&gt;.twig\n\nType page\n\n&lt;section&gt;\/&lt;layout&gt;.&lt;format&gt;.twig\n&lt;layout&gt;.&lt;format&gt;.twig\n&lt;section&gt;\/page.&lt;format&gt;.twig\n_default\/&lt;layout&gt;.&lt;format&gt;.twig\npage.&lt;format&gt;.twig\n_default\/page.&lt;format&gt;.twig\n\nType section\n\n&lt;layout&gt;.&lt;format&gt;.twig\n&lt;section&gt;\/index.&lt;format&gt;.twig\n&lt;section&gt;\/list.&lt;format&gt;.twig\nsection\/&lt;section&gt;.&lt;format&gt;.twig\n&lt;parent&gt;\/index.&lt;format&gt;.twig, &lt;parent&gt;\/list.&lt;format&gt;.twig and section\/&lt;parent&gt;.&lt;format&gt;.twig, for each parent section of a sub-section (nearest first)\n_default\/section.&lt;format&gt;.twig\nlist.&lt;format&gt;.twig\n_default\/list.&lt;format&gt;.twig\n\nThe &lt;section&gt; of a sub-section is its full path (e.g.: blog\/2024), and a sub-section falls back to the templates of its parent sections: if blog\/2024\/list.html.twig doesn’t exist, the sub-section blog\/2024 is rendered with blog\/list.html.twig.\nThe name used as &lt;section&gt; (for a section and its pages) can be mapped to the layouts of another section with the layouts.sections option.\nType vocabulary\n\ntaxonomy\/&lt;plural&gt;.&lt;format&gt;.twig\nvocabulary.&lt;format&gt;.twig\n_default\/vocabulary.&lt;format&gt;.twig\n\nType term\n\ntaxonomy\/&lt;plural&gt;\/&lt;term&gt;.&lt;format&gt;.twig\ntaxonomy\/&lt;singular&gt;.&lt;format&gt;.twig\nterm.&lt;format&gt;.twig\n_default\/term.&lt;format&gt;.twig\n_default\/list.&lt;format&gt;.twig\n\nThe vocabulary template is named after the plural (e.g.: taxonomy\/categories.html.twig for \/categories\/), whereas the term template is named after the singular (e.g.: taxonomy\/category.html.twig for \/categories\/data-sovereignty\/).\n&lt;term&gt; is the slugified term name: a dedicated template for the term \"Data Sovereignty\" of the categories vocabulary is taxonomy\/categories\/data-sovereignty.html.twig.\nMost of those layouts are available by default (in _default\/), see built-in templates.",
      "content_html": "<h1>Organization and lookup rules</h1>\n<p>Cecil renders pages with Twig templates: this page explains how templates are organized and how the right one is chosen for each page.</p>\n<h2 id=\"files-organization\">Files organization<a class=\"heading-anchor\" href=\"#files-organization\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<h3 id=\"kinds-of-templates\">Kinds of templates<a class=\"heading-anchor\" href=\"#kinds-of-templates\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>There are three kinds of templates: <strong><em>layouts</em></strong>, <strong><em>components</em></strong>, and <strong><em>other templates</em></strong>. <em>Layouts</em> are used to render <a href=\"../content/1-pages.md\">pages</a>, and each layout can <a href=\"https://twig.symfony.com/doc/templates.html#including-other-templates\" target=\"_blank\" rel=\"noopener noreferrer\">include templates</a> and <a href=\"4-components.md\">components</a>.</p>\n<h3 id=\"naming-convention\">Naming convention<a class=\"heading-anchor\" href=\"#naming-convention\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Template files are stored in the <code translate=\"no\">layouts/</code> directory and must be named according to the following convention:</p>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">layouts/(&lt;section&gt;/)&lt;type&gt;|&lt;layout&gt;.&lt;format&gt;(.&lt;language&gt;).twig</code></pre>\n<dl>\n<dt><code translate=\"no\">&lt;section&gt;</code> (<em>optional</em>)</dt>\n<dd>The section of the page (e.g.: <code translate=\"no\">blog</code>).</dd>\n<dt><code translate=\"no\">&lt;type&gt;</code></dt>\n<dd>The template type: <code translate=\"no\">home</code> (or <code translate=\"no\">index</code>) for the <em>homepage</em>, <code translate=\"no\">list</code> for list pages (<em>homepage</em> and <em>sections</em>), <code translate=\"no\">page</code> for a <em>page</em>, etc. (See <a href=\"#lookup-rules\"><em>Lookup rules</em></a> for details).</dd>\n<dt><code translate=\"no\">&lt;layout&gt;</code> (<em>optional</em>)</dt>\n<dd>The custom layout name defined in the <a href=\"../content/1-pages.md#front-matter\">front matter</a> of the page (e.g.: <code translate=\"no\">layout: my-layout</code>).</dd>\n<dt><code translate=\"no\">&lt;format&gt;</code></dt>\n<dd>The <a href=\"../configuration/8-output.md#output-formats\">output format</a> of the rendered page (e.g.: <code translate=\"no\">html</code>, <code translate=\"no\">rss</code>, <code translate=\"no\">json</code>, <code translate=\"no\">xml</code>, etc.).</dd>\n<dt><code translate=\"no\">&lt;language&gt;</code> (<em>optional</em>)</dt>\n<dd>The language of the page (e.g.: <code translate=\"no\">fr</code>).</dd>\n</dl>\n<p><em>Examples:</em></p>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">layouts/home.html.twig       # `type` is \"homepage\"\nlayouts/page.html.twig       # `type` is \"page\"\nlayouts/page.html.fr.twig    # `type` is \"page\" and `language` is \"fr\"\nlayouts/my-layout.html.twig  # `layout` is \"my-layout\"\nlayouts/blog/list.html.twig  # `section` is \"blog\"\nlayouts/blog/list.rss.twig   # `section` is \"blog\" and `format` is \"rss\"</code></pre>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">&lt;my-site&gt;\n├─ ...\n├─ layouts\n|  ├─ index.html.twig      # Used by type \"homepage\"\n|  ├─ list.html.twig       # Used by types \"homepage\" and \"section\"\n|  ├─ list.rss.twig        # Used by types \"homepage\" and \"section\", for RSS output format\n|  ├─ page.html.twig       # Used by type \"page\"\n|  ├─ taxonomy\n|  |  ├─ tags.html.twig    # Used by type \"vocabulary\" of `tags` (list of terms)\n|  |  └─ tag.html.twig     # Used by type \"term\" of `tags` (list of pages)\n|  ├─ my-layout.html.twig  # Used by pages with `layout: my-layout` in the front matter\n|  ├─ ...\n|  └─ partials             # Included templates\n|     ├─ footer.html.twig\n|     └─ ...\n└─ themes                  # Themes layouts and templates\n   └─ ...</code></pre>\n<h3 id=\"built-in-templates\">Built-in templates<a class=\"heading-anchor\" href=\"#built-in-templates\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Cecil comes with a set of <a href=\"https://github.com/Cecilapp/Cecil/tree/main/resources/layouts\" target=\"_blank\" rel=\"noopener noreferrer\">built-in templates</a>.</p>\n<aside class=\"note note-tip\"><p>If you need to modify built-in templates, you can easily extract them via the following command: they will be copied into the <code translate=\"no\">layouts</code> directory of your site.</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar util:templates:extract</code></pre></aside>\n<h2 id=\"lookup-rules\">Lookup rules<a class=\"heading-anchor\" href=\"#lookup-rules\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>In most cases <strong>you don’t need to specify the layout</strong>: Cecil selects the most appropriate layout, according to the <strong>page type</strong>.</p>\n<p>For example, the HTML output of the <strong>home page</strong> (<code translate=\"no\">index.md</code>) will be rendered:</p>\n<ol>\n<li>with <code translate=\"no\">my-layout.html.twig</code> if the <code translate=\"no\">layout</code> variable is set to \"my-layout\" (in the front matter)</li>\n<li>if not, with <code translate=\"no\">index.html.twig</code> if the file exists</li>\n<li>if not, with <code translate=\"no\">home.html.twig</code> if the file exists</li>\n<li>if not, with <code translate=\"no\">list.html.twig</code> if the file exists</li>\n</ol>\n<p>All rules are detailed below, for each page type, in the priority order.</p>\n<aside class=\"note note-info\"><p>Each candidate template is searched in the <code translate=\"no\">layouts/</code> directory of the site, then in the <code translate=\"no\">layouts/</code> directory of each <a href=\"7-extend.md#theme\">theme</a> (in the configured order), then in the built-in templates. The first file found is used.</p></aside>\n<aside class=\"note note-tip\"><p>For a page in a language other than the default one, the localized variant of each candidate (e.g.: <code translate=\"no\">page.html.fr.twig</code>) is tried first: all localized candidates are looked up before the non-localized ones.</p></aside>\n<h3 id=\"type-homepage\">Type <em>homepage</em><a class=\"heading-anchor\" href=\"#type-homepage\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<ol>\n<li><code translate=\"no\">&lt;layout&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">index.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">home.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">list.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/&lt;layout&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/index.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/home.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/list.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/page.&lt;format&gt;.twig</code></li>\n</ol>\n<h3 id=\"type-page\">Type <em>page</em><a class=\"heading-anchor\" href=\"#type-page\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<ol>\n<li><code translate=\"no\">&lt;section&gt;/&lt;layout&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">&lt;layout&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">&lt;section&gt;/page.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/&lt;layout&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">page.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/page.&lt;format&gt;.twig</code></li>\n</ol>\n<h3 id=\"type-section\">Type <em>section</em><a class=\"heading-anchor\" href=\"#type-section\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<ol>\n<li><code translate=\"no\">&lt;layout&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">&lt;section&gt;/index.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">&lt;section&gt;/list.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">section/&lt;section&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">&lt;parent&gt;/index.&lt;format&gt;.twig</code>, <code translate=\"no\">&lt;parent&gt;/list.&lt;format&gt;.twig</code> and <code translate=\"no\">section/&lt;parent&gt;.&lt;format&gt;.twig</code>, for each parent section of a sub-section (nearest first)</li>\n<li><code translate=\"no\">_default/section.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">list.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/list.&lt;format&gt;.twig</code></li>\n</ol>\n<aside class=\"note note-tip\"><p>The <code translate=\"no\">&lt;section&gt;</code> of a <a href=\"../content/1-pages.md#sub-section\">sub-section</a> is its full path (e.g.: <code translate=\"no\">blog/2024</code>), and a sub-section falls back to the templates of its parent sections: if <code translate=\"no\">blog/2024/list.html.twig</code> doesn’t exist, the sub-section <code translate=\"no\">blog/2024</code> is rendered with <code translate=\"no\">blog/list.html.twig</code>.</p></aside>\n<aside class=\"note note-info\"><p>The name used as <code translate=\"no\">&lt;section&gt;</code> (for a section and its pages) can be mapped to the layouts of another section with the <a href=\"../configuration/7-layouts.md#layouts-sections\"><code translate=\"no\">layouts.sections</code></a> option.</p></aside>\n<h3 id=\"type-vocabulary\">Type <em>vocabulary</em><a class=\"heading-anchor\" href=\"#type-vocabulary\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<ol>\n<li><code translate=\"no\">taxonomy/&lt;plural&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">vocabulary.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/vocabulary.&lt;format&gt;.twig</code></li>\n</ol>\n<h3 id=\"type-term\">Type <em>term</em><a class=\"heading-anchor\" href=\"#type-term\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<ol>\n<li><code translate=\"no\">taxonomy/&lt;plural&gt;/&lt;term&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">taxonomy/&lt;singular&gt;.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">term.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/term.&lt;format&gt;.twig</code></li>\n<li><code translate=\"no\">_default/list.&lt;format&gt;.twig</code></li>\n</ol>\n<aside class=\"note note-important\"><p>The <strong>vocabulary</strong> template is named after the <strong>plural</strong> (e.g.: <code translate=\"no\">taxonomy/categories.html.twig</code> for <code translate=\"no\">/categories/</code>), whereas the <strong>term</strong> template is named after the <strong>singular</strong> (e.g.: <code translate=\"no\">taxonomy/category.html.twig</code> for <code translate=\"no\">/categories/data-sovereignty/</code>).</p></aside>\n<aside class=\"note note-tip\"><p><code translate=\"no\">&lt;term&gt;</code> is the slugified term name: a dedicated template for the term \"Data Sovereignty\" of the <code translate=\"no\">categories</code> vocabulary is <code translate=\"no\">taxonomy/categories/data-sovereignty.html.twig</code>.</p></aside>\n<aside class=\"note note-info\"><p>Most of those layouts are available by default (in <code translate=\"no\">_default/</code>), see <a href=\"#built-in-templates\">built-in templates</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/documentation/templates/reference/functions/",
      "url": "https://cloudflare.cecil.app/documentation/templates/reference/functions/",
      "title": "Functions",
      "summary": "url, html, readtime, hash, cache_key, getenv, dump, tests, etc.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-10-22T00:00:00+00:00","content_text": "Functions\n\nFunctions can be called to generate content. Functions are called by their name followed by parentheses (()) and may have arguments.\n\nSee also: functions dedicated to assets (asset, integrity, image_srcset, image_sizes, image_from_website, etc.) are documented in the Assets section.\nurl\nCreates a valid URL for a page, a menu entry, an asset, a page ID or a path.\n{{ url(value, {options}) }}\n\n\n\nOption\nDescription\nType\nDefault\n\n\n\n\ncanonical\nPrefixes URL with baseurl or uses canonical.url if it exists.\nboolean\nvalue of canonicalurl (false by default)\n\n\nformat\nDefines page output format (e.g.: json).\nstring\nhtml\n\n\nlanguage\nDefines page language (e.g.: fr).\nstring\ncurrent language\n\n\n\nExamples:\n{# page #}\n{{ url(page) }}\n{{ url(page, {canonical: true}) }}\n{{ url(page, {format: 'json'}) }}\n{{ url(page, {language: 'fr'}) }}\n{# menu entry #}\n{{ url(site.menus.main.about) }}\n{# asset #}\n{{ url(asset('styles.css')) }}\n{# page ID #}\n{{ url('page-id') }}\n{# path #}\n{{ url('about-me\/') }}\n{{ url('tags\/' ~ tag) }}\nFor convenience the url function is also available as a filter:\n{# page #}\n{{ page|url }}\n{{ page|url({canonical: true, format: 'json', language: 'fr'}) }}\n{# asset #}\n{{ asset('styles.css')|url }}\nWhen the value is a string, url() slugifies it to find a matching page ID (e.g.: url('tags\/My Tag') returns the URL of the page tags\/my-tag). If no page matches, the string is kept as a path, with invalid characters (e.g.: spaces) percent-encoded.\nhtml\nCreates an HTML element from an asset (or an array of assets with custom attributes).\n{{ html(asset, {attributes}, {options}) }}\n{# dedicated functions for each common type of asset #}\n{{ css(asset) }}\n{{ js(asset) }}\n{{ image(asset) }}\n{{ audio(asset) }}\n{{ video(asset) }}\n\n\n\nArgument\nDescription\nType\n\n\n\n\nattributes\nAdds name=\"value\" couple to the HTML element.\narray\n\n\noptions\n{preload: boolean}: preloads.For images:{formats: array}: adds alternative formats.{responsive: bool|string}: adds responsive images (based on width or pixels density).{placeholder: string}: fills the image background before loading (color or lqip).\narray\n\n\n\nSince version 8.42.0, the html function replaces the deprecated html filter.\nYou can define a global default behavior of images options (formats, responsive and placeholder) through the layouts configuration.\nWhen layouts.images.dark_suffix is configured (e.g. .dark), Cecil automatically looks for a dark variant of each image (e.g. photo.dark.jpg alongside photo.jpg) and generates a &lt;picture&gt; element with a &lt;source media=\"(prefers-color-scheme: dark)\"&gt;.\nIn the same way, when layouts.images.mobile_suffix is configured (e.g. .mobile), Cecil looks for a mobile variant of each image (e.g. photo.mobile.jpg) and adds a &lt;source&gt; with the layouts.images.mobile_media_query media query. If a dark variant of the mobile image exists (e.g. photo.mobile.dark.jpg), it is used on mobile with dark color scheme.\nExamples:\n{# CSS with an attribute #}\n{{ html(asset('print.css'), {media: 'print'}) }}\n{# CSS with an attribute and an option #}\n{{ html(asset('styles.css'), {title: 'Main theme'}, {preload: true}) }}\n{# Array of assets with media query #}\n{{ html([\n  {asset: asset('css\/style.css')},\n  {asset: asset('css\/style-dark.css'), attributes: {media: '(prefers-color-scheme: dark)'}}\n]) }}\n{# JavaScript #}\n{{ html(asset('script.js')) }}\n{# image without specific attributes nor options #}\n{{ html(asset('image.png')) }}\n{# image with specific attributes, responsive images and alternative formats #}\n{{ html(asset('image.jpg'), {alt: 'Description', loading: 'lazy'}, {responsive: true, formats: ['avif', 'webp']}) }}\n{# image with responsive pixels density images #}\n{{ html(asset('image.jpg'), options={responsive: 'density'}, attributes={width: 256}) }}\n{# image with a Low-Quality Image Placeholder #}\n{{ html(asset('image.jpg'), {alt: 'Description', loading: 'lazy'}, {placeholder: 'lqip'}) }}\n{# Audio #}\n{{ html(asset('audio.mp3')) }}\n{# Video #}\n{{ html(asset('video.mp4')) }}\nFor convenience the html function remains available as a filter (deprecated):\n{{ asset|html({attributes}, {options}) }}\nreadtime\nDetermines read time of a text, in minutes (based on 200 words per minute, 1 minute minimum).\n{{ readtime(value) }}\nExample:\n{{ readtime(page.content) }} min\nhash\nCalculates the hash of an object, an array or a string with a given algorithm.\n{{ hash(value, algorithm) }}\nalgorithm can be any algorithm supported by PHP’s hash() function (e.g.: md5, sha256, etc.). Default is xxh128.\nExample:\n{{ hash('my string', 'sha256') }}\ncache_key\nCalculates a cache key for fragments cache based on a name and an optional value.\n{% cache cache_key(name, value) %}\n  {# cacheable content #}\n{% endcache %}\nThe function adds a hash of the value (could be a string, an array or an object) to the name (and the current language and build ID to be sure the generated cache key is unique), so if the value changes, the cache key changes too and a new cache entry is generated.\ngetenv\nGets the value of an environment variable from its key.\n{{ getenv(var) }}\nExample:\n{{ getenv('VAR') }}\ndump\nThe dump function dumps information about a template variable. This is mostly useful to debug a template that does not behave as expected by introspecting its variables:\n{{ dump(user) }}\nThe debug mode must be enabled.\nd\nThe d() function is the HTML version of dump() and uses the Symfony VarDumper Component behind the scenes.\n{{ d(variable, {theme: 'dark'}) }}\n\nIf variable is not provided, the function dumps the current Twig context\nAvailable themes are light (default) and dark\n\nThe debug mode must be enabled.\nTests\nTests can be used with the is operator.\n\n\n\nTest\nDescription\n\n\n\n\nasset\nThe variable is an asset.\n\n\nimage_large\nThe asset is a landscape image of at least 600 × 315 pixels (e.g.: a cover image).\n\n\nimage_square\nThe asset is a square image (same width and height).\n\n\nenabled\nThe option is enabled: true, a map without enabled key or with enabled: true, or any other value except false and null.\n\n\nexternal\nThe URL (or the URL of a menu entry) is external: it has a scheme (https:, mailto:, etc.) or starts with \/\/, and does not start with baseurl.\n\n\n\nExample:\n{% set image = asset(page.image) %}\n{% if image is image_large %}\n  {{ html(image, {alt: page.title}) }}\n{% endif %}\n{% if config.cache is enabled %}\n  {# `cache: false` and `cache: {enabled: false}` are both disabled #}\n{% endif %}\n{% for item in site.menus.main|sort_by_weight %}\n  &lt;a href=\"{{ url(item.url) }}\"{% if item is external %} rel=\"noopener\" target=\"_blank\"{% endif %}&gt;{{ item.name }}&lt;\/a&gt;\n{% endfor %}\nThe enabled test only checks the given value, not its parents: config.optimize.html is enabled can be true while optimize is disabled.\nA custom option may not exist: use the default filter (e.g. config.myoption|default(false) is enabled).\nDeprecated\nThe following functions are deprecated (a deprecation notice is triggered when they are used):\n\n\n\nFunction\nReplacement\n\n\n\n\nminify()\nminify filter\n\n\ntoCSS()\nto_css filter\n\n\nimage_from_url()\nimage_from_website() function\n\n\n",
      "content_html": "<h1>Functions</h1>\n<blockquote>\n<p><a href=\"https://twig.symfony.com/doc/functions/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">Functions</a> can be called to generate content. Functions are called by their name followed by parentheses (<code translate=\"no\">()</code>) and may have arguments.</p>\n</blockquote>\n<aside class=\"note note-info\"><p>See also: functions dedicated to assets (<code translate=\"no\">asset</code>, <code translate=\"no\">integrity</code>, <code translate=\"no\">image_srcset</code>, <code translate=\"no\">image_sizes</code>, <code translate=\"no\">image_from_website</code>, etc.) are documented in the <a href=\"../../assets/index.md\">Assets</a> section.</p></aside>\n<h2 id=\"url\">url<a class=\"heading-anchor\" href=\"#url\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Creates a valid URL for a page, a menu entry, an asset, a page ID or a path.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ url(value, {options}) }}</span></code></pre>\n<table>\n<thead>\n<tr>\n<th>Option</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>canonical</td>\n<td>Prefixes URL with <a href=\"../../configuration/1-site.md#baseurl\"><code translate=\"no\">baseurl</code></a> or uses <a href=\"../../configuration/1-site.md#metatags-options\"><code translate=\"no\">canonical.url</code></a> if it exists.</td>\n<td>boolean</td>\n<td>value of <a href=\"../../configuration/1-site.md#canonicalurl\"><code translate=\"no\">canonicalurl</code></a> (<code translate=\"no\">false</code> by default)</td>\n</tr>\n<tr>\n<td>format</td>\n<td>Defines page <a href=\"../../configuration/8-output.md#output-formats\">output format</a> (e.g.: <code translate=\"no\">json</code>).</td>\n<td>string</td>\n<td><code translate=\"no\">html</code></td>\n</tr>\n<tr>\n<td>language</td>\n<td>Defines page <a href=\"../../configuration/2-languages.md#language\">language</a> (e.g.: <code translate=\"no\">fr</code>).</td>\n<td>string</td>\n<td>current language</td>\n</tr>\n</tbody>\n</table>\n<p><em>Examples:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# page #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ url(page) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ url(page, {canonical: true}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ url(page, {format: 'json'}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ url(page, {language: 'fr'}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# menu entry #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ url(site.menus.main.about) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# asset #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ url(asset('styles.css')) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# page ID #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ url('page-id') }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# path #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ url('about-me/') }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ url('tags/' ~ tag) }}</span></code></pre>\n<aside class=\"note note-info\"><p>For convenience the <code translate=\"no\">url</code> function is also available as a filter:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# page #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ page|url }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ page|url({canonical: true, format: 'json', language: 'fr'}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# asset #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ asset('styles.css')|url }}</span></code></pre></aside>\n<aside class=\"note note-tip\"><p>When the value is a string, <code translate=\"no\">url()</code> slugifies it to find a matching page ID (e.g.: <code translate=\"no\">url('tags/My Tag')</code> returns the URL of the page <code translate=\"no\">tags/my-tag</code>). If no page matches, the string is kept as a path, with invalid characters (e.g.: spaces) percent-encoded.</p></aside>\n<h2 id=\"html\">html<a class=\"heading-anchor\" href=\"#html\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Creates an HTML element from an asset (or an array of assets with custom attributes).</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ html(asset, {attributes}, {options}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# dedicated functions for each common type of asset #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ css(asset) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ js(asset) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ image(asset) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ audio(asset) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ video(asset) }}</span></code></pre>\n<table>\n<thead>\n<tr>\n<th>Argument</th>\n<th>Description</th>\n<th>Type</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>attributes</td>\n<td>Adds <code translate=\"no\">name=\"value\"</code> couple to the HTML element.</td>\n<td>array</td>\n</tr>\n<tr>\n<td>options</td>\n<td><code translate=\"no\">{preload: boolean}</code>: preloads.<br>For images:<br><code translate=\"no\">{formats: array}</code>: adds alternative formats.<br><code translate=\"no\">{responsive: bool|string}</code>: adds responsive images (based on <code translate=\"no\">width</code> or pixels <code translate=\"no\">density</code>).<br><code translate=\"no\">{placeholder: string}</code>: fills the image background before loading (<code translate=\"no\">color</code> or <code translate=\"no\">lqip</code>).</td>\n<td>array</td>\n</tr>\n</tbody>\n</table>\n<aside class=\"note note-warning\"><p>Since version <ins>8.42.0</ins>, the <code translate=\"no\">html</code> function replaces the deprecated <code translate=\"no\">html</code> filter.</p></aside>\n<aside class=\"note note-tip\"><p>You can define a global default behavior of images options (<code translate=\"no\">formats</code>, <code translate=\"no\">responsive</code> and <code translate=\"no\">placeholder</code>) through the <a href=\"../../configuration/7-layouts.md#layouts-images\">layouts configuration</a>.</p>\n<p>When <a href=\"../../configuration/7-layouts.md#layouts-images\"><code translate=\"no\">layouts.images.dark_suffix</code></a> is configured (e.g. <code translate=\"no\">.dark</code>), Cecil automatically looks for a dark variant of each image (e.g. <code translate=\"no\">photo.dark.jpg</code> alongside <code translate=\"no\">photo.jpg</code>) and generates a <code translate=\"no\">&lt;picture&gt;</code> element with a <code translate=\"no\">&lt;source media=\"(prefers-color-scheme: dark)\"&gt;</code>.</p>\n<p>In the same way, when <a href=\"../../configuration/7-layouts.md#layouts-images\"><code translate=\"no\">layouts.images.mobile_suffix</code></a> is configured (e.g. <code translate=\"no\">.mobile</code>), Cecil looks for a mobile variant of each image (e.g. <code translate=\"no\">photo.mobile.jpg</code>) and adds a <code translate=\"no\">&lt;source&gt;</code> with the <a href=\"../../configuration/7-layouts.md#layouts-images\"><code translate=\"no\">layouts.images.mobile_media_query</code></a> media query. If a dark variant of the mobile image exists (e.g. <code translate=\"no\">photo.mobile.dark.jpg</code>), it is used on mobile with dark color scheme.</p></aside>\n<p><em>Examples:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# CSS with an attribute #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html(asset('print.css'), {media: 'print'}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# CSS with an attribute and an option #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html(asset('styles.css'), {title: 'Main theme'}, {preload: true}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# Array of assets with media query #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html([\n  {asset: asset('css/style.css')},\n  {asset: asset('css/style-dark.css'), attributes: {media: '(prefers-color-scheme: dark)'}}</span><span class=\"xml\">\n]) }}\n</span><span class=\"hljs-comment\">{# JavaScript #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html(asset('script.js')) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# image without specific attributes nor options #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html(asset('image.png')) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# image with specific attributes, responsive images and alternative formats #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html(asset('image.jpg'), {alt: 'Description', loading: 'lazy'}, {responsive: true, formats: ['avif', 'webp']}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# image with responsive pixels density images #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html(asset('image.jpg'), options={responsive: 'density'}, attributes={width: 256}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# image with a Low-Quality Image Placeholder #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html(asset('image.jpg'), {alt: 'Description', loading: 'lazy'}, {placeholder: 'lqip'}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# Audio #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html(asset('audio.mp3')) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# Video #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ html(asset('video.mp4')) }}</span></code></pre>\n<aside class=\"note note-info\"><p>For convenience the <code translate=\"no\">html</code> function remains available as a filter (deprecated):</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ asset|html({attributes}, {options}) }}</span></code></pre></aside>\n<h2 id=\"readtime\">readtime<a class=\"heading-anchor\" href=\"#readtime\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Determines read time of a text, in minutes (based on 200 words per minute, 1 minute minimum).</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ readtime(value) }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ readtime(page.content) }}</span><span class=\"xml\"> min</span></code></pre>\n<h2 id=\"hash\">hash<a class=\"heading-anchor\" href=\"#hash\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Calculates the hash of an object, an array or a string with a given algorithm.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ hash(value, algorithm) }}</span></code></pre>\n<p><code translate=\"no\">algorithm</code> can be any algorithm supported by PHP’s <code translate=\"no\">hash()</code> function (e.g.: <code translate=\"no\">md5</code>, <code translate=\"no\">sha256</code>, etc.). Default is <code translate=\"no\">xxh128</code>.</p>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ hash('my string', 'sha256') }}</span></code></pre>\n<h2 id=\"cache-key\">cache_key<a class=\"heading-anchor\" href=\"#cache-key\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Calculates a cache key for <a href=\"../6-cache.md#fragments-cache\"><em>fragments</em> cache</a> based on a name and an optional value.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">cache</span> cache_key(name, value) %}</span><span class=\"xml\">\n  </span><span class=\"hljs-comment\">{# cacheable content #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endcache</span> %}</span></code></pre>\n<p>The function adds a hash of the value (could be a string, an array or an object) to the name (and the current language and build ID to be sure the generated cache key is unique), so if the value changes, the cache key changes too and a new cache entry is generated.</p>\n<h2 id=\"getenv\">getenv<a class=\"heading-anchor\" href=\"#getenv\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Gets the value of an environment variable from its key.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ getenv(var) }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ getenv('VAR') }}</span></code></pre>\n<h2 id=\"dump\">dump<a class=\"heading-anchor\" href=\"#dump\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The <code translate=\"no\">dump</code> function dumps information about a template variable. This is mostly useful to debug a template that does not behave as expected by introspecting its variables:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ <span class=\"hljs-name\">dump</span><span class=\"hljs-params\">(user)</span> }}</span></code></pre>\n<aside class=\"note note-important\"><p>The <a href=\"../../configuration/1-site.md#debug\"><em>debug mode</em></a> must be enabled.</p></aside>\n<h2 id=\"d\">d<a class=\"heading-anchor\" href=\"#d\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The <code translate=\"no\">d()</code> function is the HTML version of <a href=\"#dump\"><code translate=\"no\">dump()</code></a> and uses the <a href=\"https://symfony.com/doc/current/components/var_dumper.html\" target=\"_blank\" rel=\"noopener noreferrer\">Symfony VarDumper Component</a> behind the scenes.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ d(variable, {theme: 'dark'}) }}</span></code></pre>\n<ul>\n<li>If <em>variable</em> is not provided, the function dumps the current Twig context</li>\n<li>Available themes are <code translate=\"no\">light</code> (default) and <code translate=\"no\">dark</code></li>\n</ul>\n<aside class=\"note note-important\"><p>The <a href=\"../../configuration/1-site.md#debug\"><em>debug mode</em></a> must be enabled.</p></aside>\n<h2 id=\"tests\">Tests<a class=\"heading-anchor\" href=\"#tests\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p><a href=\"https://twig.symfony.com/doc/tests/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">Tests</a> can be used with the <code translate=\"no\">is</code> operator.</p>\n<table>\n<thead>\n<tr>\n<th>Test</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">asset</code></td>\n<td>The variable is an <a href=\"../../assets/index.md#asset\">asset</a>.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">image_large</code></td>\n<td>The asset is a landscape image of at least 600 × 315 pixels (e.g.: a cover image).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">image_square</code></td>\n<td>The asset is a square image (same width and height).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">enabled</code></td>\n<td>The option is enabled: <code translate=\"no\">true</code>, a map without <code translate=\"no\">enabled</code> key or with <code translate=\"no\">enabled: true</code>, or any other value except <code translate=\"no\">false</code> and <code translate=\"no\">null</code>.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">external</code></td>\n<td>The URL (or the URL of a menu entry) is external: it has a scheme (<code translate=\"no\">https:</code>, <code translate=\"no\">mailto:</code>, etc.) or starts with <code translate=\"no\">//</code>, and does not start with <code translate=\"no\">baseurl</code>.</td>\n</tr>\n</tbody>\n</table>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> image = asset(page.image) %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> image is image_large %}</span><span class=\"xml\">\n  </span><span class=\"hljs-template-variable\">{{ html(image, {alt: page.title}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> config.cache is enabled %}</span><span class=\"xml\">\n  </span><span class=\"hljs-comment\">{# `cache: false` and `cache: {enabled: false}` are both disabled #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> item in site.menus.main|sort_by_weight %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(item.url) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> item is external %}</span><span class=\"xml\"><span class=\"hljs-tag\"> <span class=\"hljs-attr\">rel</span>=<span class=\"hljs-string\">\"noopener\"</span> <span class=\"hljs-attr\">target</span>=<span class=\"hljs-string\">\"_blank\"</span></span></span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span><span class=\"xml\"><span class=\"hljs-tag\">&gt;</span></span><span class=\"hljs-template-variable\">{{ item.name }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre>\n<aside class=\"note note-info\"><p>The <code translate=\"no\">enabled</code> test only checks the given value, not its parents: <code translate=\"no\">config.optimize.html is enabled</code> can be true while <code translate=\"no\">optimize</code> is disabled.\nA custom option may not exist: use the <code translate=\"no\">default</code> filter (e.g. <code translate=\"no\">config.myoption|default(false) is enabled</code>).</p></aside>\n<h2 id=\"deprecated\">Deprecated<a class=\"heading-anchor\" href=\"#deprecated\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The following functions are deprecated (a deprecation notice is triggered when they are used):</p>\n<table>\n<thead>\n<tr>\n<th>Function</th>\n<th>Replacement</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">minify()</code></td>\n<td><a href=\"../../assets/2-processing.md#minify\"><code translate=\"no\">minify</code></a> filter</td>\n</tr>\n<tr>\n<td><code translate=\"no\">toCSS()</code></td>\n<td><a href=\"../../assets/2-processing.md#to-css\"><code translate=\"no\">to_css</code></a> filter</td>\n</tr>\n<tr>\n<td><code translate=\"no\">image_from_url()</code></td>\n<td><a href=\"../../assets/1-images.md#image-from-website\"><code translate=\"no\">image_from_website()</code></a> function</td>\n</tr>\n</tbody>\n</table>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/documentation/templates/variables/",
      "url": "https://cloudflare.cecil.app/documentation/templates/variables/",
      "title": "Variables",
      "summary": "Variables available in templates: site, page and cecil.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-10-19T00:00:00+00:00","content_text": "Variables\n\nThe application passes variables to the templates for manipulation in the template. Variables may have attributes or elements you can access, too.\nUse a dot (.) to access attributes of a variable: {{ foo.bar }}\n\nYou can use variables from different scopes: site, page, cecil.\nsite\nThe site variable contains built-in variables and those set in the configuration.\n\n\n\nVariable\nDescription\n\n\n\n\nsite.pages\nCollection of all pages, in the current language.\n\n\nsite.allpages\nCollection of all pages, in all languages.\n\n\nsite.page(id)\nA page with the given ID.\n\n\nsite.taxonomies\nCollection of vocabularies.\n\n\nsite.home\nID of the home page.\n\n\nsite.time\nCurrent Timestamp.\n\n\nsite.debug\nDebug mode status (true or false).\n\n\nsite.build\nCurrent build ID.\n\n\n\nExample:\ntitle: \"My amazing website!\"\nCan be displayed in a template with:\n{{ site.title }}\nUse showable method on pages collection to return only published and not paginated\/redirect\/excluded pages (generated pages, such as sections or taxonomies, are included).\nExample:\n{% for page in site.pages.showable %}\n  &lt;a href=\"{{ url(page) }}\"&gt;{{ page.title }}&lt;\/a&gt;\n{% endfor %}\nIn some cases, you can encounter conflicts between configuration and built-in variables (e.g. pages.default configuration). In that case, you can use config.&lt;variable&gt; (where &lt;variable&gt; is the variable name\/path) to access the raw configuration directly.\nExample:\n{{ config.pages.default.sitemap.priority }}\nsite.menus\nLoop on site.menus.&lt;menu&gt; to get each entry of the &lt;menu&gt; collection (e.g.: main).\n\n\n\nVariable\nDescription\n\n\n\n\n&lt;entry&gt;.id\nEntry ID (for a page entry: the page ID without language prefix).\n\n\n&lt;entry&gt;.name\nEntry name.\n\n\n&lt;entry&gt;.url\nEntry URL.\n\n\n&lt;entry&gt;.weight\nEntry weight (useful to sort menu entries).\n\n\n\nExample:\n&lt;nav&gt;\n  &lt;ol&gt;\n  {% for entry in site.menus.main|sort_by_weight %}\n    &lt;li&gt;&lt;a href=\"{{ url(entry.url) }}\" data-weight=\"{{ entry.weight }}\"&gt;{{ entry.name }}&lt;\/a&gt;&lt;\/li&gt;\n  {% endfor %}\n  &lt;\/ol&gt;\n&lt;\/nav&gt;\nsite.language\nInformation about the current language.\n\n\n\nVariable\nDescription\n\n\n\n\nsite.language\nLanguage code (e.g.: en).\n\n\nsite.language.name\nLanguage name (e.g.: English).\n\n\nsite.language.locale\nLanguage locale code (e.g.: en_US).\n\n\nsite.language.weight\nLanguage position in the languages list.\n\n\n\nYou can retrieve name, locale and weight of a specific language by passing its code as a parameter.\ne.g.: site.language.name('fr').\nsite.static\nThe static files collection can be accessed via site.static if the static load is enabled.\nEach file exposes the following properties:\n\nfile: relative file path, as found in the static\/ directory (e.g.: images\/img-1.jpg)\npath: relative path, with forward slashes (e.g.: images\/img-1.jpg)\ndate: creation date (DateTime)\nupdated: modification date (DateTime)\nname: name (e.g.: img-1.jpg)\nbasename: name without extension (e.g.: img-1)\next: extension (e.g.: jpg)\ntype: media type (e.g.: image)\nsubtype: media sub type (e.g.: image\/jpeg)\nexif: image EXIF data (array)\naudio: Mp3Info object\nvideo: array of basic video information (duration in seconds, width and height)\n\nsite.data\nA data collection can be accessed via site.data.&lt;filename&gt; (without file extension).\nExamples:\n\ndata\/authors.yml : site.data.authors\ndata\/authors.fr.yml : site.data.authors (if site.language = \"fr\")\ndata\/galleries\/gallery-1.json : site.data.galleries['gallery-1']\n\npage\nThe page variable contains built-in variables of a page and those set in the front matter.\n\n\n\nVariable\nDescription\nExample\n\n\n\n\npage.id\nUnique identifier.\nblog\/post-1\n\n\npage.title\nFile name (without extension).\nPost 1\n\n\npage.date\nFile creation date.\nDateTime\n\n\npage.body\nFile body.\nMarkdown\n\n\npage.content\nFile body converted in HTML.\nHTML\n\n\npage.section\nFile root folder (slugified).\nblog\n\n\npage.path\nFile path (slugified).\nblog\/post-1\n\n\npage.slug\nFile name (slugified).\npost-1\n\n\npage.filepath\nFile system path.\nBlog\/Post 1.md\n\n\npage.type\nhomepage, page, section, vocabulary or term.\npage\n\n\npage.pages\nCollection of all sub pages.\nCollection\n\n\npage.translations\nCollection of translated pages.\nCollection\n\n\n\nUse showable method on pages collection to return only published and not paginated\/redirect\/excluded pages (generated pages, such as sections or taxonomies, are included).\nExample:\n{% for page in page.pages.showable %}\n  &lt;a href=\"{{ url(page) }}\"&gt;{{ page.title }}&lt;\/a&gt;\n{% endfor %}\nNested sections\nIn a nested sections context, page.parent, page.ancestors, page.sections and page.toplevel help you build navigation.\n\n\n\nVariable\nDescription\nExample\n\n\n\n\npage.parent\nParent section's page (null if none).\nPage\n\n\npage.ancestors\nCollection of ancestor sections (nearest first).\nCollection\n\n\npage.sections\nCollection of immediate descendant sections.\nCollection\n\n\npage.toplevel\ntrue if the page is a top level section.\nBoolean\n\n\n\nBreadcrumb (from the home page to the current page):\n&lt;nav aria-label=\"breadcrumb\"&gt;\n  &lt;ul&gt;\n    &lt;li&gt;&lt;a href=\"{{ url(site.home) }}\"&gt;{{ site.title }}&lt;\/a&gt;&lt;\/li&gt;\n    {% for section in page.ancestors|reverse %}\n    &lt;li&gt;&lt;a href=\"{{ url(section) }}\"&gt;{{ section.title }}&lt;\/a&gt;&lt;\/li&gt;\n    {% endfor %}\n    {% if page.id != site.home %}\n    &lt;li&gt;&lt;a href=\"{{ url(page) }}\" aria-current=\"page\"&gt;{{ page.title }}&lt;\/a&gt;&lt;\/li&gt;\n    {% endif %}\n  &lt;\/ul&gt;\n&lt;\/nav&gt;\nA ready-to-use breadcrumb.html.twig partial is available:\n{{ include('partials\/breadcrumb.html.twig') }}\nSub-sections menu (immediate descendant sections of the current section):\n{% if page.sections|length %}\n&lt;ul&gt;\n  {% for section in page.sections|sort_by_title %}\n  &lt;li&gt;&lt;a href=\"{{ url(section) }}\"&gt;{{ section.title }}&lt;\/a&gt;&lt;\/li&gt;\n  {% endfor %}\n&lt;\/ul&gt;\n{% endif %}\nMain navigation limited to top level sections (from any page):\n&lt;nav&gt;\n  {% for section in site.page(site.home).sections|sort_by_title %}\n  &lt;a href=\"{{ url(section) }}\"&gt;{{ section.title }}&lt;\/a&gt;\n  {% endfor %}\n&lt;\/nav&gt;\nLink to the parent section:\n{% if page.parent %}\n&lt;a href=\"{{ url(page.parent) }}\"&gt;← {{ page.parent.title }}&lt;\/a&gt;\n{% endif %}\npage.&lt;prev\/next&gt;\nNavigation between pages within the same section, sorted according to the section's sortby (chronological order for dates).\nWith sub-sections, navigation follows the sections tree: the pages of a top level Section and of all its sub-sections are chained, each sub-section (its index page) being placed among the pages of its parent Section and followed by its own pages.\n\n\n\nVariable\nDescription\nExample\n\n\n\n\npage.prev\nPrevious page.\nPage\n\n\npage.next\nNext page.\nPage\n\n\n\nExample:\n{% if page.prev is defined %}\n&lt;a href=\"{{ url(page.prev) }}\"&gt;{{ page.prev.title }}&lt;\/a&gt;\n{% endif %}\npage.paginator\nPaginator helps you build navigation for list pages: homepage, sections, and taxonomies.\n\n\n\nVariable\nDescription\n\n\n\n\npage.paginator.pages\nPages Collection.\n\n\npage.paginator.pages_total\nTotal number of pages.\n\n\npage.paginator.count\nNumber of paginator's pages.\n\n\npage.paginator.current\nPosition index of the current page.\n\n\npage.paginator.links.first\nPage ID of the first page.\n\n\npage.paginator.links.prev\nPage ID of the previous page.\n\n\npage.paginator.links.self\nPage ID of the current page.\n\n\npage.paginator.links.next\nPage ID of the next page.\n\n\npage.paginator.links.last\nPage ID of the last page.\n\n\npage.paginator.links.path\nPage ID without the position index.\n\n\n\nBecause links entries are Page ID you must use the url() function to create working links.\ne.g.: {{ url(page.paginator.links.next) }}\nExample:\n{% if page.paginator %}\n&lt;div&gt;\n  {% if page.paginator.links.prev is defined %}\n  &lt;a href=\"{{ url(page.paginator.links.prev) }}\"&gt;Previous&lt;\/a&gt;\n  {% endif %}\n  {% if page.paginator.links.next is defined %}\n  &lt;a href=\"{{ url(page.paginator.links.next) }}\"&gt;Next&lt;\/a&gt;\n  {% endif %}\n&lt;\/div&gt;\n{% endif %}\nExample:\n{% if page.paginator %}\n&lt;div&gt;\n  {% for paginator_index in 1..page.paginator.count %}\n    {% if paginator_index != page.paginator.current %}\n      {% if paginator_index == 1 %}\n  &lt;a href=\"{{ url(page.paginator.links.first) }}\"&gt;{{ paginator_index }}&lt;\/a&gt;\n      {% else %}\n  &lt;a href=\"{{ url(page.paginator.links.path ~ '\/' ~ paginator_index) }}\"&gt;{{ paginator_index }}&lt;\/a&gt;\n      {% endif %}\n    {% else %}\n  {{ paginator_index }}\n    {% endif %}\n  {% endfor %}\n&lt;\/div&gt;\n{% endif %}\nTaxonomy\nVariables available in vocabulary and term templates.\nVocabulary\nPage \/&lt;plural&gt;\/ (e.g.: \/categories\/).\n\n\n\nVariable\nDescription\n\n\n\n\npage.plural\nVocabulary name in plural form.\n\n\npage.singular\nVocabulary name in singular form.\n\n\npage.terms\nList of terms (Collection).\n\n\n\nEach term of page.terms provides term.id (term ID, e.g.: categories\/php), term.name (term name, e.g.: PHP) and the number of its pages with term|length.\nTerm\nPage \/&lt;plural&gt;\/&lt;term&gt;\/ (e.g.: \/categories\/php\/).\n\n\n\nVariable\nDescription\n\n\n\n\npage.title\nTerm name.\n\n\npage.term\nTerm ID (e.g.: categories\/php).\n\n\npage.plural\nVocabulary name in plural form.\n\n\npage.singular\nVocabulary name in singular form.\n\n\npage.pages\nList of pages in this term, sorted by date (Collection).\n\n\n\nTaxonomy example\nConfiguration:\ntaxonomies:\n  categories: category\nPage front matter:\n---\ncategories: [\"Data Sovereignty\"]\n---\nList of terms (\/categories\/), in layouts\/taxonomy\/categories.html.twig:\n{% extends 'page.html.twig' %}\n\n{% block content %}\n  &lt;h1&gt;{{ page.title }}&lt;\/h1&gt;\n  &lt;ul&gt;\n  {% for term in page.terms %}\n    &lt;li&gt;&lt;a href=\"{{ url(term.id) }}\"&gt;{{ term.name }}&lt;\/a&gt; ({{ term|length }})&lt;\/li&gt;\n  {% endfor %}\n  &lt;\/ul&gt;\n{% endblock %}\nList of pages of a term (\/categories\/data-sovereignty\/), in layouts\/taxonomy\/category.html.twig:\n{% extends 'page.html.twig' %}\n\n{% block content %}\n  &lt;h1&gt;{{ page.title }}&lt;\/h1&gt;\n  {% for p in page.paginator.pages ?? page.pages %}\n    &lt;article&gt;\n      &lt;h2&gt;&lt;a href=\"{{ url(p) }}\"&gt;{{ p.title }}&lt;\/a&gt;&lt;\/h2&gt;\n    &lt;\/article&gt;\n  {% endfor %}\n  &lt;a href=\"{{ url(page.plural) }}\"&gt;All {{ page.plural }}&lt;\/a&gt;\n{% endblock %}\nLinks to the terms of the current page, in a page template:\n{% for category in page.categories ?? [] %}\n  &lt;a href=\"{{ url('categories\/' ~ category) }}\"&gt;{{ category }}&lt;\/a&gt;\n{% endfor %}\nThe url() function slugifies the given string to find the matching page: url('categories\/Data Sovereignty') returns \/categories\/data-sovereignty\/.\nYou can also use the built-in partial {{ include('partials\/terms-list.html.twig', {vocabulary: 'categories'}) }}.\ncecil\n\n\n\nVariable\nDescription\n\n\n\n\ncecil.url\nURL of the Cecil website.\n\n\ncecil.version\nCecil current version.\n\n\ncecil.poweredby\nPrints Cecil v%s, where %s is the current version.\n\n\n",
      "content_html": "<h1>Variables</h1>\n<blockquote>\n<p>The application passes variables to the templates for manipulation in the template. Variables may have attributes or elements you can access, too.<br>\nUse a dot (.) to access attributes of a variable: <code translate=\"no\">{{ foo.bar }}</code></p>\n</blockquote>\n<p>You can use variables from different scopes: <a href=\"#site\"><code translate=\"no\">site</code></a>, <a href=\"#page\"><code translate=\"no\">page</code></a>, <a href=\"#cecil\"><code translate=\"no\">cecil</code></a>.</p>\n<h2 id=\"site\">site<a class=\"heading-anchor\" href=\"#site\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The <code translate=\"no\">site</code> variable contains built-in variables <strong>and</strong> those set in the <a href=\"../configuration/index.md\">configuration</a>.</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">site.pages</code></td>\n<td>Collection of all pages, in the current language.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.allpages</code></td>\n<td>Collection of all pages, in all languages.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.page(id)</code></td>\n<td>A page with the given ID.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.taxonomies</code></td>\n<td>Collection of vocabularies.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.home</code></td>\n<td>ID of the home page.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.time</code></td>\n<td>Current <a href=\"https://wikipedia.org/wiki/Unix_time\" target=\"_blank\" rel=\"noopener noreferrer\"><em>Timestamp</em></a>.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.debug</code></td>\n<td>Debug mode status (<code translate=\"no\">true</code> or <code translate=\"no\">false</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.build</code></td>\n<td>Current build ID.</td>\n</tr>\n</tbody>\n</table>\n<p><em>Example:</em></p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">\"My amazing website!\"</span></code></pre>\n<p>Can be displayed in a template with:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ site.title }}</span></code></pre>\n<aside class=\"note note-important\"><p>Use <code translate=\"no\">showable</code> method on pages collection to return only published and not <em>paginated/redirect/excluded</em> pages (generated pages, such as sections or taxonomies, are included).</p>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> page in site.pages.showable %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ page.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre></aside>\n<aside class=\"note note-warning\"><p>In some cases, you can encounter conflicts between configuration and built-in variables (e.g. <code translate=\"no\">pages.default</code> configuration). In that case, you can use <code translate=\"no\">config.&lt;variable&gt;</code> (where <code translate=\"no\">&lt;variable&gt;</code> is the variable name/path) to access the raw configuration directly.</p>\n<p>Example:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ config.pages.default.sitemap.priority }}</span></code></pre></aside>\n<h3 id=\"site-menus\">site.menus<a class=\"heading-anchor\" href=\"#site-menus\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Loop on <code translate=\"no\">site.menus.&lt;menu&gt;</code> to get each entry of the <code translate=\"no\">&lt;menu&gt;</code> collection (e.g.: <code translate=\"no\">main</code>).</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">&lt;entry&gt;.id</code></td>\n<td>Entry ID (for a page entry: the page ID without language prefix).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">&lt;entry&gt;.name</code></td>\n<td>Entry name.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">&lt;entry&gt;.url</code></td>\n<td>Entry URL.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">&lt;entry&gt;.weight</code></td>\n<td>Entry weight (useful to sort menu entries).</td>\n</tr>\n</tbody>\n</table>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">nav</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ol</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> entry in site.menus.main|sort_by_weight %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(entry.url) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">data-weight</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ entry.weight }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ entry.name }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">li</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">ol</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">nav</span>&gt;</span></span></code></pre>\n<h3 id=\"site-language\">site.language<a class=\"heading-anchor\" href=\"#site-language\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Information about the current language.</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">site.language</code></td>\n<td>Language code (e.g.: <code translate=\"no\">en</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.language.name</code></td>\n<td>Language name (e.g.: <code translate=\"no\">English</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.language.locale</code></td>\n<td>Language <a href=\"../configuration/3-locale-codes.md\">locale code</a> (e.g.: <code translate=\"no\">en_US</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.language.weight</code></td>\n<td>Language position in the <code translate=\"no\">languages</code> list.</td>\n</tr>\n</tbody>\n</table>\n<aside class=\"note note-tip\"><p>You can retrieve <code translate=\"no\">name</code>, <code translate=\"no\">locale</code> and <code translate=\"no\">weight</code> of a specific language by passing its code as a parameter.<br>\ne.g.: <code translate=\"no\">site.language.name('fr')</code>.</p></aside>\n<h3 id=\"site-static\">site.static<a class=\"heading-anchor\" href=\"#site-static\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>The static files collection can be accessed via <code translate=\"no\">site.static</code> if the <a href=\"../configuration/5-data-static.md#static-load\"><em>static load</em></a> is enabled.</p>\n<p>Each file exposes the following properties:</p>\n<ul>\n<li><code translate=\"no\">file</code>: relative file path, as found in the <code translate=\"no\">static/</code> directory (e.g.: <code translate=\"no\">images/img-1.jpg</code>)</li>\n<li><code translate=\"no\">path</code>: relative path, with forward slashes (e.g.: <code translate=\"no\">images/img-1.jpg</code>)</li>\n<li><code translate=\"no\">date</code>: creation date (<em>DateTime</em>)</li>\n<li><code translate=\"no\">updated</code>: modification date (<em>DateTime</em>)</li>\n<li><code translate=\"no\">name</code>: name (e.g.: <code translate=\"no\">img-1.jpg</code>)</li>\n<li><code translate=\"no\">basename</code>: name without extension (e.g.: <code translate=\"no\">img-1</code>)</li>\n<li><code translate=\"no\">ext</code>: extension (e.g.: <code translate=\"no\">jpg</code>)</li>\n<li><code translate=\"no\">type</code>: media type (e.g.: <code translate=\"no\">image</code>)</li>\n<li><code translate=\"no\">subtype</code>: media sub type (e.g.: <code translate=\"no\">image/jpeg</code>)</li>\n<li><code translate=\"no\">exif</code>: image EXIF data (<em>array</em>)</li>\n<li><code translate=\"no\">audio</code>: <a href=\"https://github.com/wapmorgan/Mp3Info#audio-information\" target=\"_blank\" rel=\"noopener noreferrer\">Mp3Info</a> object</li>\n<li><code translate=\"no\">video</code>: array of basic video information (duration in seconds, width and height)</li>\n</ul>\n<h3 id=\"site-data\">site.data<a class=\"heading-anchor\" href=\"#site-data\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>A data collection can be accessed via <code translate=\"no\">site.data.&lt;filename&gt;</code> (without file extension).</p>\n<p><em>Examples:</em></p>\n<ul>\n<li><code translate=\"no\">data/authors.yml</code> : <code translate=\"no\">site.data.authors</code></li>\n<li><code translate=\"no\">data/authors.fr.yml</code> : <code translate=\"no\">site.data.authors</code> (if <code translate=\"no\">site.language</code> = \"fr\")</li>\n<li><code translate=\"no\">data/galleries/gallery-1.json</code> : <code translate=\"no\">site.data.galleries['gallery-1']</code></li>\n</ul>\n<h2 id=\"page\">page<a class=\"heading-anchor\" href=\"#page\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The <code translate=\"no\">page</code> variable contains built-in variables of a page <strong>and</strong> those set in the <a href=\"../content/1-pages.md#front-matter\">front matter</a>.</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n<th>Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">page.id</code></td>\n<td>Unique identifier.</td>\n<td><code translate=\"no\">blog/post-1</code></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.title</code></td>\n<td>File name (without extension).</td>\n<td><code translate=\"no\">Post 1</code></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.date</code></td>\n<td>File creation date.</td>\n<td><em>DateTime</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.body</code></td>\n<td>File body.</td>\n<td><em>Markdown</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.content</code></td>\n<td>File body converted in HTML.</td>\n<td><em>HTML</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.section</code></td>\n<td>File root folder (<em>slugified</em>).</td>\n<td><code translate=\"no\">blog</code></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.path</code></td>\n<td>File path (<em>slugified</em>).</td>\n<td><code translate=\"no\">blog/post-1</code></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.slug</code></td>\n<td>File name (<em>slugified</em>).</td>\n<td><code translate=\"no\">post-1</code></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.filepath</code></td>\n<td>File system path.</td>\n<td><code translate=\"no\">Blog/Post 1.md</code></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.type</code></td>\n<td><code translate=\"no\">homepage</code>, <code translate=\"no\">page</code>, <code translate=\"no\">section</code>, <code translate=\"no\">vocabulary</code> or <code translate=\"no\">term</code>.</td>\n<td><code translate=\"no\">page</code></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.pages</code></td>\n<td>Collection of all sub pages.</td>\n<td><em>Collection</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.translations</code></td>\n<td>Collection of translated pages.</td>\n<td><em>Collection</em></td>\n</tr>\n</tbody>\n</table>\n<aside class=\"note note-important\"><p>Use <code translate=\"no\">showable</code> method on pages collection to return only published and not <em>paginated/redirect/excluded</em> pages (generated pages, such as sections or taxonomies, are included).</p>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> page in page.pages.showable %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ page.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre></aside>\n<h3 id=\"nested-sections\">Nested sections<a class=\"heading-anchor\" href=\"#nested-sections\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>In a <a href=\"../content/1-pages.md#sub-section\">nested sections</a> context, <code translate=\"no\">page.parent</code>, <code translate=\"no\">page.ancestors</code>, <code translate=\"no\">page.sections</code> and <code translate=\"no\">page.toplevel</code> help you build navigation.</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n<th>Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">page.parent</code></td>\n<td>Parent <em>section</em>'s page (<code translate=\"no\">null</code> if none).</td>\n<td><em>Page</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.ancestors</code></td>\n<td>Collection of ancestor <em>sections</em> (nearest first).</td>\n<td><em>Collection</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.sections</code></td>\n<td>Collection of immediate descendant <em>sections</em>.</td>\n<td><em>Collection</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.toplevel</code></td>\n<td><code translate=\"no\">true</code> if the page is a top level <em>section</em>.</td>\n<td><em>Boolean</em></td>\n</tr>\n</tbody>\n</table>\n<p><em>Breadcrumb (from the home page to the current page):</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">nav</span> <span class=\"hljs-attr\">aria-label</span>=<span class=\"hljs-string\">\"breadcrumb\"</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ul</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(site.home) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ site.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">li</span>&gt;</span>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> section in page.ancestors|<span class=\"hljs-keyword\">reverse</span> %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(section) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ section.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">li</span>&gt;</span>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.id != site.home %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <span class=\"hljs-attr\">aria-current</span>=<span class=\"hljs-string\">\"page\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ page.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">li</span>&gt;</span>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">ul</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">nav</span>&gt;</span></span></code></pre>\n<aside class=\"note note-tip\"><p>A ready-to-use <a href=\"https://github.com/Cecilapp/Cecil/blob/main/resources/layouts/partials/breadcrumb.html.twig\" target=\"_blank\" rel=\"noopener noreferrer\"><code translate=\"no\">breadcrumb.html.twig</code></a> partial is available:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ <span class=\"hljs-name\">include</span><span class=\"hljs-params\">('partials/breadcrumb.html.twig')</span> }}</span></code></pre></aside>\n<p><em>Sub-sections menu (immediate descendant sections of the current section):</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.sections|<span class=\"hljs-keyword\">length</span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ul</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> section in page.sections|sort_by_title %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(section) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ section.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">li</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">ul</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<p><em>Main navigation limited to top level sections (from any page):</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">nav</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> section in site.page(site.home).sections|sort_by_title %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(section) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ section.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">nav</span>&gt;</span></span></code></pre>\n<p><em>Link to the parent section:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.<span class=\"hljs-name\">parent</span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.<span class=\"hljs-name\">parent</span>) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span>← </span><span class=\"hljs-template-variable\">{{ page.<span class=\"hljs-name\">parent</span>.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<h3 id=\"page-prev-next\">page.&lt;prev/next&gt;<a class=\"heading-anchor\" href=\"#page-prev-next\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Navigation between pages within the same <em>section</em>, sorted according to the section's <code translate=\"no\">sortby</code> (chronological order for dates).</p>\n<p>With <a href=\"../content/1-pages.md#sub-section\">sub-sections</a>, navigation follows the sections tree: the pages of a top level <em>Section</em> and of all its sub-sections are chained, each sub-section (its index page) being placed among the pages of its parent <em>Section</em> and followed by its own pages.</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n<th>Example</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">page.prev</code></td>\n<td>Previous page.</td>\n<td><em>Page</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.next</code></td>\n<td>Next page.</td>\n<td><em>Page</em></td>\n</tr>\n</tbody>\n</table>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.prev is defined %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.prev) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ page.prev.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<h3 id=\"page-paginator\">page.paginator<a class=\"heading-anchor\" href=\"#page-paginator\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p><em>Paginator</em> helps you build navigation for list pages: homepage, sections, and taxonomies.</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">page.paginator.pages</code></td>\n<td>Pages Collection.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.pages_total</code></td>\n<td>Total number of pages.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.count</code></td>\n<td>Number of paginator's pages.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.current</code></td>\n<td>Position index of the current page.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.first</code></td>\n<td>Page ID of the first page.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.prev</code></td>\n<td>Page ID of the previous page.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.self</code></td>\n<td>Page ID of the current page.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.next</code></td>\n<td>Page ID of the next page.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.last</code></td>\n<td>Page ID of the last page.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.path</code></td>\n<td>Page ID without the position index.</td>\n</tr>\n</tbody>\n</table>\n<aside class=\"note note-important\"><p>Because links entries are Page ID you must use the <code translate=\"no\">url()</code> function to create working links.<br>\ne.g.: <code translate=\"no\">{{ url(page.paginator.links.next) }}</code></p></aside>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.paginator %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.paginator.links.prev is defined %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.paginator.links.prev) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span>Previous<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span><span class=\"xml\">\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.paginator.links.next is defined %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.paginator.links.next) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span>Next<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">div</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.paginator %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> paginator_index in 1..page.paginator.count %}</span><span class=\"xml\">\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> paginator_index != page.paginator.current %}</span><span class=\"xml\">\n      </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> paginator_index == 1 %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.paginator.links.first) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ paginator_index }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n      </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">else</span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.paginator.links.path ~ '/' ~ paginator_index) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ paginator_index }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n      </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span><span class=\"xml\">\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">else</span> %}</span><span class=\"xml\">\n  </span><span class=\"hljs-template-variable\">{{ paginator_index }}</span><span class=\"xml\">\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span><span class=\"xml\">\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">div</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<h3 id=\"taxonomy\">Taxonomy<a class=\"heading-anchor\" href=\"#taxonomy\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Variables available in <em>vocabulary</em> and <em>term</em> templates.</p>\n<h4 id=\"vocabulary\">Vocabulary</h4>\n<p>Page <code translate=\"no\">/&lt;plural&gt;/</code> (e.g.: <code translate=\"no\">/categories/</code>).</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">page.plural</code></td>\n<td>Vocabulary name in plural form.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.singular</code></td>\n<td>Vocabulary name in singular form.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.terms</code></td>\n<td>List of terms (<em>Collection</em>).</td>\n</tr>\n</tbody>\n</table>\n<p>Each term of <code translate=\"no\">page.terms</code> provides <code translate=\"no\">term.id</code> (term ID, e.g.: <code translate=\"no\">categories/php</code>), <code translate=\"no\">term.name</code> (term name, e.g.: <code translate=\"no\">PHP</code>) and the number of its pages with <code translate=\"no\">term|length</code>.</p>\n<h4 id=\"term\">Term</h4>\n<p>Page <code translate=\"no\">/&lt;plural&gt;/&lt;term&gt;/</code> (e.g.: <code translate=\"no\">/categories/php/</code>).</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">page.title</code></td>\n<td>Term name.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.term</code></td>\n<td>Term ID (e.g.: <code translate=\"no\">categories/php</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.plural</code></td>\n<td>Vocabulary name in plural form.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.singular</code></td>\n<td>Vocabulary name in singular form.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.pages</code></td>\n<td>List of pages in this term, sorted by date (<em>Collection</em>).</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"taxonomy-example\">Taxonomy example</h4>\n<p>Configuration:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">taxonomies:</span>\n  <span class=\"hljs-attr\">categories:</span> <span class=\"hljs-string\">category</span></code></pre>\n<p>Page front matter:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">categories:</span> <span class=\"hljs-string\">[\"Data</span> <span class=\"hljs-string\">Sovereignty\"]</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<p>List of terms (<code translate=\"no\">/categories/</code>), in <code translate=\"no\">layouts/taxonomy/categories.html.twig</code>:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">extends</span></span> 'page.html.twig' %}</span><span class=\"xml\">\n\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">block</span></span> content %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ page.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">h1</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ul</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> term in page.terms %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(term.id) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ term.name }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span> (</span><span class=\"hljs-template-variable\">{{ term|<span class=\"hljs-keyword\">length</span> }}</span><span class=\"xml\">)<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">li</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">ul</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endblock</span></span> %}</span></code></pre>\n<p>List of pages of a term (<code translate=\"no\">/categories/data-sovereignty/</code>), in <code translate=\"no\">layouts/taxonomy/category.html.twig</code>:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">extends</span></span> 'page.html.twig' %}</span><span class=\"xml\">\n\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">block</span></span> content %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ page.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">h1</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> p in page.paginator.pages ?? page.pages %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">article</span>&gt;</span>\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h2</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(p) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ p.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">h2</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">article</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.plural) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span>All </span><span class=\"hljs-template-variable\">{{ page.plural }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endblock</span></span> %}</span></code></pre>\n<p>Links to the terms of the current page, in a page template:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> category in page.categories ?? [] %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url('categories/' ~ category) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ category }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre>\n<aside class=\"note note-tip\"><p>The <a href=\"reference/1-functions.md#url\"><code translate=\"no\">url()</code></a> function slugifies the given string to find the matching page: <code translate=\"no\">url('categories/Data Sovereignty')</code> returns <code translate=\"no\">/categories/data-sovereignty/</code>.</p>\n<p>You can also use the built-in partial <code translate=\"no\">{{ include('partials/terms-list.html.twig', {vocabulary: 'categories'}) }}</code>.</p></aside>\n<h2 id=\"cecil\">cecil<a class=\"heading-anchor\" href=\"#cecil\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">cecil.url</code></td>\n<td>URL of the Cecil website.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">cecil.version</code></td>\n<td>Cecil current version.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">cecil.poweredby</code></td>\n<td>Prints <code translate=\"no\">Cecil v%s</code>, where <code translate=\"no\">%s</code> is the current version.</td>\n</tr>\n</tbody>\n</table>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/documentation/templates/reference/sorts/",
      "url": "https://cloudflare.cecil.app/documentation/templates/reference/sorts/",
      "title": "Sorts",
      "summary": "Sort collections of pages, menus or taxonomies.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Sorts\nSorting collections (of pages, menus or taxonomies).\nsort_by_title\nSorts a collection by title (with natural sort).\n{{ collection|sort_by_title }}\nExample:\n{{ site.pages|sort_by_title }}\nsort_by_date\nSorts a collection by date (most recent first).\n{{ collection|sort_by_date(variable='date', desc_title=false) }}\n\nvariable: the date variable to sort by (date by default)\ndesc_title: sorts items with the same date by title, in descending order (false by default)\n\nExample:\n{# sort by date #}\n{{ site.pages|sort_by_date }}\n{# sort by updated variable instead of date #}\n{{ site.pages|sort_by_date(variable='updated') }}\n{# sort items with the same date by desc title #}\n{{ site.pages|sort_by_date(desc_title=true) }}\n{# reverse sort #}\n{{ site.pages|sort_by_date|reverse }}\nsort_by_weight\nSorts a collection by weight (lighter first).\n{{ collection|sort_by_weight }}\nExample:\n{{ site.menus.main|sort_by_weight }}\nsort\nFor more complex cases, you should use Twig’s native sort.\nExample:\n{% set files = site.static|sort((a, b) =&gt; b.date &lt;=&gt; a.date) %}\nCollection methods\nA pages collection (e.g.: site.pages, page.pages) also provides sorting methods, which return a pages collection:\n\nsortBy(options): sorts by date, updated, title or weight\nsortByDate(options), sortByTitle(options), sortByWeight(options)\n\noptions can be the name of the variable (e.g.: 'title') or an object with the keys variable, descTitle (sort by date only) and reverse.\nExamples:\n{% for p in site.pages.showable.sortBy('title') %}…{% endfor %}\n{% for p in site.pages.showable.sortBy({variable: 'updated', reverse: true}) %}…{% endfor %}",
      "content_html": "<h1>Sorts</h1>\n<p>Sorting collections (of pages, menus or taxonomies).</p>\n<h2 id=\"sort-by-title\">sort_by_title<a class=\"heading-anchor\" href=\"#sort-by-title\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Sorts a collection by title (with <a href=\"https://en.wikipedia.org/wiki/Natural_sort_order\" target=\"_blank\" rel=\"noopener noreferrer\">natural sort</a>).</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ collection|sort_by_title }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ site.pages|sort_by_title }}</span></code></pre>\n<h2 id=\"sort-by-date\">sort_by_date<a class=\"heading-anchor\" href=\"#sort-by-date\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Sorts a collection by date (most recent first).</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ collection|sort_by_date(variable='<span class=\"hljs-name\">date</span>', desc_title=false) }}</span></code></pre>\n<ul>\n<li><code translate=\"no\">variable</code>: the date variable to sort by (<code translate=\"no\">date</code> by default)</li>\n<li><code translate=\"no\">desc_title</code>: sorts items with the same date by title, in descending order (<code translate=\"no\">false</code> by default)</li>\n</ul>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# sort by date #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ site.pages|sort_by_date }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# sort by updated variable instead of date #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ site.pages|sort_by_date(variable='updated') }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# sort items with the same date by desc title #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ site.pages|sort_by_date(desc_title=true) }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# reverse sort #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ site.pages|sort_by_date|<span class=\"hljs-keyword\">reverse</span> }}</span></code></pre>\n<h2 id=\"sort-by-weight\">sort_by_weight<a class=\"heading-anchor\" href=\"#sort-by-weight\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Sorts a collection by weight (lighter first).</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ collection|sort_by_weight }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ site.menus.main|sort_by_weight }}</span></code></pre>\n<h2 id=\"sort\">sort<a class=\"heading-anchor\" href=\"#sort\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>For more complex cases, you should use <a href=\"https://twig.symfony.com/doc/filters/sort.html\" target=\"_blank\" rel=\"noopener noreferrer\">Twig’s native <code translate=\"no\">sort</code></a>.</p>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> files = site.static|<span class=\"hljs-keyword\">sort</span>((a, b) =&gt; b.<span class=\"hljs-name\">date</span> &lt;=&gt; a.<span class=\"hljs-name\">date</span>) %}</span></code></pre>\n<h2 id=\"collection-methods\">Collection methods<a class=\"heading-anchor\" href=\"#collection-methods\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>A pages collection (e.g.: <code translate=\"no\">site.pages</code>, <code translate=\"no\">page.pages</code>) also provides sorting methods, which return a pages collection:</p>\n<ul>\n<li><code translate=\"no\">sortBy(options)</code>: sorts by <code translate=\"no\">date</code>, <code translate=\"no\">updated</code>, <code translate=\"no\">title</code> or <code translate=\"no\">weight</code></li>\n<li><code translate=\"no\">sortByDate(options)</code>, <code translate=\"no\">sortByTitle(options)</code>, <code translate=\"no\">sortByWeight(options)</code></li>\n</ul>\n<p><code translate=\"no\">options</code> can be the name of the variable (e.g.: <code translate=\"no\">'title'</code>) or an object with the keys <code translate=\"no\">variable</code>, <code translate=\"no\">descTitle</code> (sort by date only) and <code translate=\"no\">reverse</code>.</p>\n<p><em>Examples:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> p in site.pages.showable.sortBy('title') %}</span><span class=\"xml\">…</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> p in site.pages.showable.sortBy({variable: 'updated', reverse: true}) %}</span><span class=\"xml\">…</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/documentation/templates/reference/filters/",
      "url": "https://cloudflare.cecil.app/documentation/templates/reference/filters/",
      "title": "Filters",
      "summary": "filter_by, markdown_to_html, toc, slugify, excerpt, highlight, preg_*, etc.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-11-15T00:00:00+00:00","content_text": "Filters\nVariables can be modified by filters. Filters are separated from the variable by a pipe symbol (|). Multiple filters can be chained. The output of one filter is applied to the next.\n{{ page.title|truncate(25)|capitalize }}\nSee also: filters dedicated to assets (resize, minify, fingerprint, to_css, inline, webp, lqip, etc.) are documented in the Assets section.\nfilter_by\nFilters a pages collection by variable name\/value.\n{{ collection|filter_by(variable, value) }}\nOnly regular pages (type page, not redirections) are returned.\nExample:\n{{ pages|filter_by('section', 'blog') }}\nfilter\nFor more complex cases, you should use Twig’s native filter.\nExample:\n{% set filtered = pages|filter(p =&gt; p.generated == false and p.id not in ['page-1', 'page-2']) %}\nmarkdown_to_html\nConverts a Markdown string to HTML.\n{{ markdown|markdown_to_html }}\n{% apply markdown_to_html %}\n{# Markdown here #}\n{% endapply %}\nExamples:\n{% set markdown = '**This is bold text**' %}\n{{ markdown|markdown_to_html }}\n{% apply markdown_to_html %}\n**This is bold text**\n{% endapply %}\ntoc\nExtracts only headings matching the given selectors (h2, h3, etc.), or those defined in config pages.body.toc if not specified.\nThe format parameter defines the output format: html (default) or json.\nThe url parameter is used to build links to headings.\n{{ markdown|toc(format, selectors, url) }}\nExamples:\n{{ page.body|toc }}\n{{ page.body|toc('html') }}\n{{ page.body|toc(selectors=['h2']) }}\n{{ page.body|toc(url=url(page)) }}\njson_decode\nConverts a JSON string to an array.\n{{ json|json_decode }}\nExample:\n{% set json = '{\"foo\": \"bar\"}' %}\n{% set array = json|json_decode %}\n{{ array.foo }}\nyaml_parse\nConverts a YAML string to an array.\n{{ yaml|yaml_parse }}\nExample:\n{% set yaml = 'key: value' %}\n{% set array = yaml|yaml_parse %}\n{{ array.key }}\nslugify\nConverts a string to a slug.\n{{ string|slugify }}\nu\nThe u filter wraps a text in a Unicode object (a Symfony UnicodeString instance) that exposes methods to \"manipulate\" the string.\nExample:\n{{ 'cecil_string with twig'|u.camel.title }}\n\nCecilStringWithTwig\n\nsingular\nThe singular filter transforms a given noun in its plural form into its singular version.\n{{ string|singular(locale) }}\nExample:\n{# English (en) rules are used by default #}\n{{ 'partitions'|singular }}\n\npartition\n\n{{ 'partitions'|singular('fr') }}\n\npartition\n\nplural\nThe plural filter transforms a given noun in its singular form into its plural version.\n{{ string|plural(locale) }}\nExample:\n{# English (en) rules are used by default #}\n{{ 'animal'|plural }}\n\nanimals\n\n{{ 'animal'|plural('fr') }}\n\nanimaux\n\nexcerpt\nTruncates a string and appends a suffix.\n{{ string|excerpt(length, suffix) }}\n\n\n\nOption\nDescription\nType\nDefault\n\n\n\n\nlength\nTruncates after this number of characters.\ninteger\n450\n\n\nsuffix\nAppends characters.\nstring\n' …' (space and ellipsis)\n\n\n\nExamples:\n{{ variable|excerpt }}\n{{ variable|excerpt(250, '...') }}\nexcerpt_html\nReads characters before or after &lt;!-- excerpt --&gt; or &lt;!-- break --&gt; tag.\nSee Content documentation for details.\n{{ string|excerpt_html({separator, capture}) }}\n\n\n\nOption\nDescription\nType\nDefault\n\n\n\n\nseparator\nString to use as separator.\nstring\nexcerpt|break\n\n\ncapture\nPart to capture, before or after the separator.\nstring\nbefore\n\n\n\nDefault values are defined by the pages.body.excerpt configuration.\nExamples:\n{{ variable|excerpt_html }}\n{{ variable|excerpt_html({separator: 'excerpt|break', capture: 'before'}) }}\n{{ variable|excerpt_html({capture: 'after'}) }}\nabsolute_urls\nMakes the root-relative URLs (e.g. \/about\/, \/images\/photo.png) of the href, src and srcset attributes of an HTML content absolute, with the scheme and the host of the baseurl, to use the content outside of the site (feeds, e-mails, etc.).\nOther URLs (absolute or protocol-relative URLs, relative paths, anchors, mailto:, data:, etc.) are kept as is, and the content is unchanged if the baseurl is not absolute.\n{{ string|absolute_urls }}\nExample:\n{# with `baseurl: https:\/\/example.com\/` #}\n{{ '&lt;a href=\"\/about\/\"&gt;About&lt;\/a&gt; &lt;img src=\"\/images\/photo.png\" srcset=\"\/images\/photo-320.png 320w\"&gt;'|absolute_urls }}\n{# &lt;a href=\"https:\/\/example.com\/about\/\"&gt;About&lt;\/a&gt; &lt;img src=\"https:\/\/example.com\/images\/photo.png\" srcset=\"https:\/\/example.com\/images\/photo-320.png 320w\"&gt; #}\nThe built-in feeds (Atom, RSS and JSON Feed) apply this filter to the content of their items.\nhighlight\nHighlights a code string.\n{{ code|highlight(language, engine) }}\nThe highlighter engine (highlightjs or tempest) is the optional engine argument or, by default, the layouts.highlight.engine option (highlightjs by default).\nThe filter does not use the pages.body.highlight.engine option, which only applies to Markdown content.\nIf the language is not supported by the engine, the code is returned escaped, without highlighting (and a warning is logged).\nExamples:\n{{ '&lt;?php echo $highlighted-&gt;value; ?&gt;'|highlight('php') }}\n{{ '&lt;?php echo $highlighted-&gt;value; ?&gt;'|highlight('php', 'tempest') }}\nEach engine uses its own CSS classes (hljs-* for highlightjs, hl-* for tempest): the stylesheet must match the engine used.\npreg_split\nSplits a string into an array using a regular expression (limit is 0, i.e. no limit, by default).\n{{ string|preg_split(pattern, limit) }}\nExample:\n{% set headers = page.content|preg_split('\/&lt;br[^&gt;]*&gt;\/') %}\npreg_match_all\nPerforms a regular expression match and returns the group for all matches (group is 0, i.e. the full match, by default).\n{{ string|preg_match_all(pattern, group) }}\nExample:\n{% set tags = page.content|preg_match_all('\/&lt;[^&gt;]+&gt;(.*)&lt;\\\/[^&gt;]+&gt;\/') %}\nhex_to_rgb\nConverts a hexadecimal color to RGB: returns an array with red, green and blue keys.\n{{ color|hex_to_rgb }}\nExample:\n{% set rgb = '#f00'|hex_to_rgb %}\nrgb({{ rgb.red }}, {{ rgb.green }}, {{ rgb.blue }})\n\nrgb(255, 0, 0)\n\nsplitline\nSplits a string into an array of lines of max characters maximum (18 by default), without breaking words.\n{{ string|splitline(max) }}\nExample:\n{% for line in 'The quick brown fox jumps'|splitline(10) %}\n  {{ line }}&lt;br&gt;\n{% endfor %}\n\nThe quickbrown foxjumps\n\niterable\nConverts a variable to an iterable (array): an array is returned as is, a traversable object is converted to an array, and any other value is wrapped in an array.\n{{ variable|iterable }}\nExample:\n{% for author in page.authors|iterable %}\n  {{ author }}\n{% endfor %}\nunique\nRemoves duplicate values from an array of strings (case-insensitive: the first occurrence is kept).\n{{ array|unique }}\nExample:\n{{ ['PHP', 'php', 'Twig']|unique|join(', ') }}\n\nPHP, Twig\n\nduration_to_iso8601\nConverts a duration in seconds to an ISO 8601 duration (e.g.: for the duration of a video in structured data).\n{{ seconds|duration_to_iso8601 }}\nExample:\n{{ 125|duration_to_iso8601 }}\n\nPT00H00M125S\n",
      "content_html": "<h1>Filters</h1>\n<p>Variables can be modified by <a href=\"https://twig.symfony.com/doc/filters/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">filters</a>. Filters are separated from the variable by a pipe symbol (<code translate=\"no\">|</code>). Multiple filters can be chained. The output of one filter is applied to the next.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ page.title|truncate(25)|<span class=\"hljs-keyword\">capitalize</span> }}</span></code></pre>\n<aside class=\"note note-info\"><p>See also: filters dedicated to assets (<code translate=\"no\">resize</code>, <code translate=\"no\">minify</code>, <code translate=\"no\">fingerprint</code>, <code translate=\"no\">to_css</code>, <code translate=\"no\">inline</code>, <code translate=\"no\">webp</code>, <code translate=\"no\">lqip</code>, etc.) are documented in the <a href=\"../../assets/index.md\">Assets</a> section.</p></aside>\n<h2 id=\"filter-by\">filter_by<a class=\"heading-anchor\" href=\"#filter-by\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Filters a pages collection by variable name/value.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ collection|filter_by(variable, value) }}</span></code></pre>\n<p>Only regular pages (type <code translate=\"no\">page</code>, not redirections) are returned.</p>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ pages|filter_by('section', 'blog') }}</span></code></pre>\n<h2 id=\"filter\">filter<a class=\"heading-anchor\" href=\"#filter\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>For more complex cases, you should use <a href=\"https://twig.symfony.com/doc/filters/filter.html\" target=\"_blank\" rel=\"noopener noreferrer\">Twig’s native <code translate=\"no\">filter</code></a>.</p>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> filtered = pages|<span class=\"hljs-keyword\">filter</span>(p =&gt; p.generated == false and p.id not in ['page-1', 'page-2']) %}</span></code></pre>\n<h2 id=\"markdown-to-html\">markdown_to_html<a class=\"heading-anchor\" href=\"#markdown-to-html\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Converts a Markdown string to HTML.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ markdown|markdown_to_html }}</span></code></pre>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">apply</span></span> markdown_to_html %}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# Markdown here #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endapply</span></span> %}</span></code></pre>\n<p><em>Examples:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> markdown = '**This is bold text**' %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ markdown|markdown_to_html }}</span></code></pre>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">apply</span></span> markdown_to_html %}</span><span class=\"xml\">\n**This is bold text**\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endapply</span></span> %}</span></code></pre>\n<h2 id=\"toc\">toc<a class=\"heading-anchor\" href=\"#toc\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Extracts only headings matching the given <code translate=\"no\">selectors</code> (h2, h3, etc.), or those defined in config <code translate=\"no\">pages.body.toc</code> if not specified.<br>\nThe <code translate=\"no\">format</code> parameter defines the output format: <code translate=\"no\">html</code> (default) or <code translate=\"no\">json</code>.<br>\nThe <code translate=\"no\">url</code> parameter is used to build links to headings.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ markdown|toc(format, selectors, url) }}</span></code></pre>\n<p><em>Examples:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ page.body|toc }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ page.body|toc('html') }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ page.body|toc(selectors=['h2']) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ page.body|toc(url=url(page)) }}</span></code></pre>\n<h2 id=\"json-decode\">json_decode<a class=\"heading-anchor\" href=\"#json-decode\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Converts a JSON string to an array.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ json|json_decode }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> json = '{\"foo\": \"bar\"}' %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> array = json|json_decode %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ array.foo }}</span></code></pre>\n<h2 id=\"yaml-parse\">yaml_parse<a class=\"heading-anchor\" href=\"#yaml-parse\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Converts a YAML string to an array.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ yaml|yaml_parse }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> yaml = 'key: value' %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> array = yaml|yaml_parse %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ array.key }}</span></code></pre>\n<h2 id=\"slugify\">slugify<a class=\"heading-anchor\" href=\"#slugify\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Converts a string to a slug.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ string|slugify }}</span></code></pre>\n<h2 id=\"u\">u<a class=\"heading-anchor\" href=\"#u\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The <code translate=\"no\">u</code> filter wraps a text in a Unicode object (a <a href=\"https://symfony.com/doc/current/components/string.html\" target=\"_blank\" rel=\"noopener noreferrer\">Symfony UnicodeString instance</a>) that exposes methods to \"manipulate\" the string.</p>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ 'cecil_string with twig'|u.camel.title }}</span></code></pre>\n<blockquote>\n<p>CecilStringWithTwig</p>\n</blockquote>\n<h2 id=\"singular\">singular<a class=\"heading-anchor\" href=\"#singular\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The <code translate=\"no\">singular</code> filter transforms a given noun in its plural form into its singular version.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ string|singular(locale) }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# English (en) rules are used by default #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ 'partitions'|singular }}</span></code></pre>\n<blockquote>\n<p>partition</p>\n</blockquote>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ 'partitions'|singular('fr') }}</span></code></pre>\n<blockquote>\n<p>partition</p>\n</blockquote>\n<h2 id=\"plural\">plural<a class=\"heading-anchor\" href=\"#plural\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The <code translate=\"no\">plural</code> filter transforms a given noun in its singular form into its plural version.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ string|plural(locale) }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# English (en) rules are used by default #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ 'animal'|plural }}</span></code></pre>\n<blockquote>\n<p>animals</p>\n</blockquote>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ 'animal'|plural('fr') }}</span></code></pre>\n<blockquote>\n<p>animaux</p>\n</blockquote>\n<h2 id=\"excerpt\">excerpt<a class=\"heading-anchor\" href=\"#excerpt\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Truncates a string and appends a suffix.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ string|excerpt(length, suffix) }}</span></code></pre>\n<table>\n<thead>\n<tr>\n<th>Option</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>length</td>\n<td>Truncates after this number of characters.</td>\n<td>integer</td>\n<td>450</td>\n</tr>\n<tr>\n<td>suffix</td>\n<td>Appends characters.</td>\n<td>string</td>\n<td><code translate=\"no\">' …'</code> (space and ellipsis)</td>\n</tr>\n</tbody>\n</table>\n<p><em>Examples:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ variable|excerpt }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ variable|excerpt(250, '...') }}</span></code></pre>\n<h2 id=\"excerpt-html\">excerpt_html<a class=\"heading-anchor\" href=\"#excerpt-html\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Reads characters before or after <code translate=\"no\">&lt;!-- excerpt --&gt;</code> or <code translate=\"no\">&lt;!-- break --&gt;</code> tag.<br>\nSee <a href=\"../../content/3-markdown.md#excerpt\">Content documentation</a> for details.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ string|excerpt_html({separator, capture}) }}</span></code></pre>\n<table>\n<thead>\n<tr>\n<th>Option</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>separator</td>\n<td>String to use as separator.</td>\n<td>string</td>\n<td><code translate=\"no\">excerpt|break</code></td>\n</tr>\n<tr>\n<td>capture</td>\n<td>Part to capture, <code translate=\"no\">before</code> or <code translate=\"no\">after</code> the separator.</td>\n<td>string</td>\n<td><code translate=\"no\">before</code></td>\n</tr>\n</tbody>\n</table>\n<p>Default values are defined by the <code translate=\"no\">pages.body.excerpt</code> configuration.</p>\n<p><em>Examples:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ variable|excerpt_html }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ variable|excerpt_html({separator: 'excerpt|break', capture: 'before'}) }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ variable|excerpt_html({capture: 'after'}) }}</span></code></pre>\n<h2 id=\"absolute-urls\">absolute_urls<a class=\"heading-anchor\" href=\"#absolute-urls\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Makes the root-relative URLs (e.g. <code translate=\"no\">/about/</code>, <code translate=\"no\">/images/photo.png</code>) of the <code translate=\"no\">href</code>, <code translate=\"no\">src</code> and <code translate=\"no\">srcset</code> attributes of an HTML content absolute, with the scheme and the host of the <code translate=\"no\">baseurl</code>, to use the content outside of the site (feeds, e-mails, etc.).</p>\n<p>Other URLs (absolute or protocol-relative URLs, relative paths, anchors, <code translate=\"no\">mailto:</code>, <code translate=\"no\">data:</code>, etc.) are kept as is, and the content is unchanged if the <code translate=\"no\">baseurl</code> is not absolute.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ string|absolute_urls }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# with `baseurl: https://example.com/` #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ '&lt;a href=\"/about/\"&gt;About&lt;/a&gt; &lt;img src=\"/images/photo.png\" srcset=\"/images/photo-320.png 320w\"&gt;'|absolute_urls }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# &lt;a href=\"https://example.com/about/\"&gt;About&lt;/a&gt; &lt;img src=\"https://example.com/images/photo.png\" srcset=\"https://example.com/images/photo-320.png 320w\"&gt; #}</span></code></pre>\n<aside class=\"note note-info\"><p>The built-in feeds (Atom, RSS and JSON Feed) apply this filter to the content of their items.</p></aside>\n<h2 id=\"highlight\">highlight<a class=\"heading-anchor\" href=\"#highlight\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Highlights a code string.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ code|highlight(language, engine) }}</span></code></pre>\n<p>The highlighter engine (<code translate=\"no\">highlightjs</code> or <code translate=\"no\">tempest</code>) is the optional <code translate=\"no\">engine</code> argument or, by default, the <a href=\"../../configuration/7-layouts.md#layouts-highlight\"><code translate=\"no\">layouts.highlight.engine</code></a> option (<code translate=\"no\">highlightjs</code> by default).</p>\n<aside class=\"note note-tip\"><p>The filter does not use the <a href=\"../../configuration/4-pages.md#pages-body-highlight\"><code translate=\"no\">pages.body.highlight.engine</code></a> option, which only applies to Markdown content.</p></aside>\n<p>If the language is not supported by the engine, the code is returned escaped, without highlighting (and a warning is logged).</p>\n<p><em>Examples:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ '&lt;?php echo $highlighted-&gt;value; ?&gt;'|highlight('php') }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ '&lt;?php echo $highlighted-&gt;value; ?&gt;'|highlight('php', 'tempest') }}</span></code></pre>\n<aside class=\"note note-info\"><p>Each engine uses its own CSS classes (<code translate=\"no\">hljs-*</code> for <code translate=\"no\">highlightjs</code>, <code translate=\"no\">hl-*</code> for <code translate=\"no\">tempest</code>): the stylesheet must match the engine used.</p></aside>\n<h2 id=\"preg-split\">preg_split<a class=\"heading-anchor\" href=\"#preg-split\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Splits a string into an array using a regular expression (<code translate=\"no\">limit</code> is <code translate=\"no\">0</code>, i.e. no limit, by default).</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ string|preg_split(pattern, limit) }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> headers = page.content|preg_split('/&lt;br[^&gt;]*&gt;/') %}</span></code></pre>\n<h2 id=\"preg-match-all\">preg_match_all<a class=\"heading-anchor\" href=\"#preg-match-all\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Performs a regular expression match and returns the group for all matches (<code translate=\"no\">group</code> is <code translate=\"no\">0</code>, i.e. the full match, by default).</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ string|preg_match_all(pattern, group) }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> tags = page.content|preg_match_all('/&lt;[^&gt;]+&gt;(.*)&lt;\\/[^&gt;]+&gt;/') %}</span></code></pre>\n<h2 id=\"hex-to-rgb\">hex_to_rgb<a class=\"heading-anchor\" href=\"#hex-to-rgb\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Converts a hexadecimal color to RGB: returns an array with <code translate=\"no\">red</code>, <code translate=\"no\">green</code> and <code translate=\"no\">blue</code> keys.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ color|hex_to_rgb }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> rgb = '#f00'|hex_to_rgb %}</span><span class=\"xml\">\nrgb(</span><span class=\"hljs-template-variable\">{{ rgb.red }}</span><span class=\"xml\">, </span><span class=\"hljs-template-variable\">{{ rgb.green }}</span><span class=\"xml\">, </span><span class=\"hljs-template-variable\">{{ rgb.blue }}</span><span class=\"xml\">)</span></code></pre>\n<blockquote>\n<p>rgb(255, 0, 0)</p>\n</blockquote>\n<h2 id=\"splitline\">splitline<a class=\"heading-anchor\" href=\"#splitline\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Splits a string into an array of lines of <code translate=\"no\">max</code> characters maximum (<code translate=\"no\">18</code> by default), without breaking words.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ string|splitline(<span class=\"hljs-name\">max</span>) }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> line in 'The quick brown fox jumps'|splitline(10) %}</span><span class=\"xml\">\n  </span><span class=\"hljs-template-variable\">{{ line }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">br</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre>\n<blockquote>\n<p>The quick<br>brown fox<br>jumps</p>\n</blockquote>\n<h2 id=\"iterable\">iterable<a class=\"heading-anchor\" href=\"#iterable\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Converts a variable to an iterable (array): an array is returned as is, a traversable object is converted to an array, and any other value is wrapped in an array.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ variable|iterable }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> author in page.authors|iterable %}</span><span class=\"xml\">\n  </span><span class=\"hljs-template-variable\">{{ author }}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre>\n<h2 id=\"unique\">unique<a class=\"heading-anchor\" href=\"#unique\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Removes duplicate values from an array of strings (case-insensitive: the first occurrence is kept).</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ array|unique }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ ['PHP', 'php', 'Twig']|unique|<span class=\"hljs-keyword\">join</span>(', ') }}</span></code></pre>\n<blockquote>\n<p>PHP, Twig</p>\n</blockquote>\n<h2 id=\"duration-to-iso8601\">duration_to_iso8601<a class=\"heading-anchor\" href=\"#duration-to-iso8601\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Converts a duration in seconds to an <a href=\"https://en.wikipedia.org/wiki/ISO_8601#Durations\" target=\"_blank\" rel=\"noopener noreferrer\">ISO 8601 duration</a> (e.g.: for the <code translate=\"no\">duration</code> of a video in structured data).</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ seconds|duration_to_iso8601 }}</span></code></pre>\n<p><em>Example:</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ 125|duration_to_iso8601 }}</span></code></pre>\n<blockquote>\n<p>PT00H00M125S</p>\n</blockquote>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/documentation/templates/components/",
      "url": "https://cloudflare.cecil.app/documentation/templates/components/",
      "title": "Components",
      "summary": "Create reusable template components.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Components\nCecil provides components to help you build reusable template \"units\".\nThe components feature is provided by the Twig components extension created by Giorgio Pogliani.\nComponents syntax\nComponents are Twig templates stored in the components\/ subdirectory of layouts\/ (e.g.: layouts\/components\/button.twig), and can be used anywhere in your templates:\n{# layouts\/components\/button.twig #}\n&lt;button {{ attributes.merge({class: 'rounded px-4'}) }}&gt;\n    {{ slot }}\n&lt;\/button&gt;\n\nThe slot variable contains any content you add between the opening and closing tags.\n\nTo use a component, use the dedicated tag x followed by : and the file name of your component without extension:\n{# layouts\/index.html.twig #}\n{% x:button with {class: 'text-white'} %}\n    &lt;strong&gt;Click me&lt;\/strong&gt;\n{% endx %}\nIt will render:\n&lt;button class=\"text-white rounded px-4\"&gt;\n    &lt;strong&gt;Click me&lt;\/strong&gt;\n&lt;\/button&gt;\nHTML syntax\nThe same component can be used with an HTML-like syntax:\n&lt;x-button class=\"text-white\"&gt;\n    &lt;strong&gt;Click me&lt;\/strong&gt;\n&lt;\/x-button&gt;\nTo evaluate an attribute value as a Twig expression, prefix its name with : (e.g.: &lt;x-button :label=\"page.title\"&gt;).\nSubfolders\nComponents stored in subfolders are reached with the dot notation:\n{# layouts\/components\/button\/primary.twig #}\n{% x:button.primary %}Click me{% endx %}\n{# or #}\n&lt;x-button.primary&gt;Click me&lt;\/x-button.primary&gt;\nNamed slots\nA component can expose several named slots:\n{# layouts\/components\/card.twig #}\n&lt;div {{ attributes.class('card') }}&gt;\n    &lt;h2 {{ title.attributes.class('card-title') }}&gt;{{ title }}&lt;\/h2&gt;\n    &lt;div&gt;{{ body }}&lt;\/div&gt;\n&lt;\/div&gt;\n{% x:card %}\n    {% slot:title with {class: 'text-2xl'} %}Title{% endslot %}\n    {% slot:body %}Body{% endslot %}\n{% endx %}\n{# or #}\n&lt;x-card&gt;\n    &lt;x-slot name=\"title\" class=\"text-2xl\"&gt;Title&lt;\/x-slot&gt;\n    &lt;x-slot name=\"body\"&gt;Body&lt;\/x-slot&gt;\n&lt;\/x-card&gt;\nConfiguration\nThe components directory and file extension can be changed with the layouts.components options (dir, components by default, and ext, twig by default).",
      "content_html": "<h1>Components</h1>\n<p>Cecil provides components to help you build reusable template \"units\".</p>\n<aside class=\"note note-info\"><p>The components feature is provided by the <a href=\"https://github.com/giorgiopogliani/twig-components\" target=\"_blank\" rel=\"noopener noreferrer\"><em>Twig components extension</em></a> created by Giorgio Pogliani.</p></aside>\n<h2 id=\"components-syntax\">Components syntax<a class=\"heading-anchor\" href=\"#components-syntax\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Components are Twig templates stored in the <code translate=\"no\">components/</code> subdirectory of <code translate=\"no\">layouts/</code> (e.g.: <code translate=\"no\">layouts/components/button.twig</code>), and can be used anywhere in your templates:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# layouts/components/button.twig #}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button</span> </span></span><span class=\"hljs-template-variable\">{{ attributes.merge({class: 'rounded px-4'}) }}</span><span class=\"xml\"><span class=\"hljs-tag\">&gt;</span>\n    </span><span class=\"hljs-template-variable\">{{ slot }}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">button</span>&gt;</span></span></code></pre>\n<blockquote>\n<p>The <code translate=\"no\">slot</code> variable contains any content you add between the opening and closing tags.</p>\n</blockquote>\n<p>To use a component, use the dedicated tag <code translate=\"no\">x</code> followed by <code translate=\"no\">:</code> and the file name of your component without extension:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# layouts/index.html.twig #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">x</span>:button with {class: 'text-white'} %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">strong</span>&gt;</span>Click me<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">strong</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endx</span> %}</span></code></pre>\n<p>It will render:</p>\n<pre data-lang=\"html\"><code class=\"language-html hljs xml\" translate=\"no\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">class</span>=<span class=\"hljs-string\">\"text-white rounded px-4\"</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">strong</span>&gt;</span>Click me<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">strong</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">button</span>&gt;</span></code></pre>\n<h3 id=\"html-syntax\">HTML syntax<a class=\"heading-anchor\" href=\"#html-syntax\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>The same component can be used with an HTML-like syntax:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">x-button</span> <span class=\"hljs-attr\">class</span>=<span class=\"hljs-string\">\"text-white\"</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">strong</span>&gt;</span>Click me<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">strong</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">x-button</span>&gt;</span></span></code></pre>\n<p>To evaluate an attribute value as a Twig expression, prefix its name with <code translate=\"no\">:</code> (e.g.: <code translate=\"no\">&lt;x-button :label=\"page.title\"&gt;</code>).</p>\n<h3 id=\"subfolders\">Subfolders<a class=\"heading-anchor\" href=\"#subfolders\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Components stored in subfolders are reached with the <em>dot notation</em>:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# layouts/components/button/primary.twig #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">x</span>:button.primary %}</span><span class=\"xml\">Click me</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endx</span> %}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# or #}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">x-button.primary</span>&gt;</span>Click me<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">x-button.primary</span>&gt;</span></span></code></pre>\n<h3 id=\"named-slots\">Named slots<a class=\"heading-anchor\" href=\"#named-slots\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>A component can expose several named slots:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# layouts/components/card.twig #}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div</span> </span></span><span class=\"hljs-template-variable\">{{ attributes.class('card') }}</span><span class=\"xml\"><span class=\"hljs-tag\">&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h2</span> </span></span><span class=\"hljs-template-variable\">{{ title.attributes.class('card-title') }}</span><span class=\"xml\"><span class=\"hljs-tag\">&gt;</span></span><span class=\"hljs-template-variable\">{{ title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">h2</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ body }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">div</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">div</span>&gt;</span></span></code></pre>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">x</span>:card %}</span><span class=\"xml\">\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">slot</span>:title with {class: 'text-2xl'} %}</span><span class=\"xml\">Title</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endslot</span> %}</span><span class=\"xml\">\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">slot</span>:body %}</span><span class=\"xml\">Body</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endslot</span> %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endx</span> %}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# or #}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">x-card</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">x-slot</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"title\"</span> <span class=\"hljs-attr\">class</span>=<span class=\"hljs-string\">\"text-2xl\"</span>&gt;</span>Title<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">x-slot</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">x-slot</span> <span class=\"hljs-attr\">name</span>=<span class=\"hljs-string\">\"body\"</span>&gt;</span>Body<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">x-slot</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">x-card</span>&gt;</span></span></code></pre>\n<h2 id=\"configuration\">Configuration<a class=\"heading-anchor\" href=\"#configuration\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The components directory and file extension can be changed with the <a href=\"../configuration/7-layouts.md#layouts-components\"><code translate=\"no\">layouts.components</code></a> options (<code translate=\"no\">dir</code>, <code translate=\"no\">components</code> by default, and <code translate=\"no\">ext</code>, <code translate=\"no\">twig</code> by default).</p>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/documentation/templates/localization/",
      "url": "https://cloudflare.cecil.app/documentation/templates/localization/",
      "title": "Localization",
      "summary": "Translate texts and localize dates in templates.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-12-04T00:00:00+00:00","content_text": "Localization\nCecil supports text translation and date localization.\nText translation\nUse the trans tag or filter to translate texts in templates.\n{% trans with variables into locale %}{% endtrans %}\n{{ message|trans(variables = []) }}\nExamples\n{% trans %}Hello World!{% endtrans %}\n{{ message|trans }}\nInclude variables:\n{% trans with {'%name%': 'Arnaud'} %}Hello %name%!{% endtrans %}\n{{ message|trans({'%name%': 'Arnaud'}) }}\nForce locale:\n{% trans into 'fr_FR' %}Hello World!{% endtrans %}\nPluralize:\n{% trans with {'%count%': 42} %}{0}I don't have apples|{1}I have one apple|]1,Inf[I have %count% apples{% endtrans %}\nTranslation files\nTranslation files must be named messages.&lt;locale&gt;.&lt;extension&gt; and stored in the translations directory.\nSupported file extensions are defined by each translation format in layouts.translations.formats.\nThe locale code (e.g.: fr_FR) of a language is defined in the languages entries of the configuration. A file named with the language code only (e.g.: messages.fr.yaml) is also loaded, and the translations of the themes are merged with those of the site.\nExample:\n&lt;my-site&gt;\n└─ translations\n   ├─ messages.fr_FR.mo   &lt;- Machine Object format\n   └─ messages.fr_FR.yaml &lt;- YAML format\nYou can easily extract translations from your templates with the following command:\nphp cecil.phar util:translations:extract --locale=&lt;code&gt; --show\nUse --save instead of (or in addition to) --show to save the translations to a file. The --locale option is required. The default output format is yaml, saved in .yml files (use --extension=yaml for .yaml files, or --format=po for gettext PO format).\nThe labels and descriptions of the front matter schemas are extracted too, into the schemas file (e.g. schemas.fr.yml).\nPoedit is a simple and cross-platform translation editor for gettext (PO), and Poedit Pro supports extraction of translation strings from templates out of the box.\nTranslations are cached: the cache is refreshed when a translation file is updated or removed, but not when a new one is added.\nCache can be cleared with the following command:\nphp cecil.phar cache:clear:translations\nDate localization\nUse the Twig format_date filter to localize a date in templates.\n{{ page.date|format_date('long') }}\n{# September 30, 2022 #}\nSupported values are: none, short, medium, long, and full.\nThe format_datetime and format_time filters are also available.\nIf you want to use these filters with locales other than \"en\", you should install the intl PHP extension.",
      "content_html": "<h1>Localization</h1>\n<p>Cecil supports <a href=\"#text-translation\">text translation</a> and <a href=\"#date-localization\">date localization</a>.</p>\n<h2 id=\"text-translation\">Text translation<a class=\"heading-anchor\" href=\"#text-translation\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Use the <code translate=\"no\">trans</code> <em>tag</em> or <em>filter</em> to translate texts in templates.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">trans</span> with variables into locale %}</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endtrans</span> %}</span></code></pre>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ message|trans(variables = []) }}</span></code></pre>\n<h3 id=\"examples\">Examples<a class=\"heading-anchor\" href=\"#examples\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">trans</span> %}</span><span class=\"xml\">Hello World!</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endtrans</span> %}</span></code></pre>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ message|trans }}</span></code></pre>\n<p>Include variables:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">trans</span> with {'%name%': 'Arnaud'} %}</span><span class=\"xml\">Hello %name%!</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endtrans</span> %}</span></code></pre>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ message|trans({'%name%': 'Arnaud'}) }}</span></code></pre>\n<p>Force locale:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">trans</span> into 'fr_FR' %}</span><span class=\"xml\">Hello World!</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endtrans</span> %}</span></code></pre>\n<p>Pluralize:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">trans</span> with {'%count%': 42} %}</span><span class=\"xml\">{0}I don't have apples|{1}I have one apple|]1,Inf[I have %count% apples</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endtrans</span> %}</span></code></pre>\n<h2 id=\"translation-files\">Translation files<a class=\"heading-anchor\" href=\"#translation-files\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Translation files must be named <code translate=\"no\">messages.&lt;locale&gt;.&lt;extension&gt;</code> and stored in the <a href=\"../configuration/7-layouts.md#layouts-translations\"><code translate=\"no\">translations</code></a> directory.<br>\nSupported file extensions are defined by each translation format in <a href=\"../configuration/7-layouts.md#layouts-translations\"><code translate=\"no\">layouts.translations.formats</code></a>.</p>\n<p>The locale code (e.g.: <code translate=\"no\">fr_FR</code>) of a language is defined in the <a href=\"../configuration/2-languages.md#languages\"><code translate=\"no\">languages</code></a> entries of the configuration. A file named with the language code only (e.g.: <code translate=\"no\">messages.fr.yaml</code>) is also loaded, and the translations of the <a href=\"7-extend.md#theme\">themes</a> are merged with those of the site.</p>\n<p><em>Example:</em></p>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">&lt;my-site&gt;\n└─ translations\n   ├─ messages.fr_FR.mo   &lt;- Machine Object format\n   └─ messages.fr_FR.yaml &lt;- YAML format</code></pre>\n<aside class=\"note note-info\"><p>You can easily extract translations from your templates with the following command:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar util:translations:extract --locale=&lt;code&gt; --show</code></pre>\n<p>Use <code translate=\"no\">--save</code> instead of (or in addition to) <code translate=\"no\">--show</code> to save the translations to a file. The <code translate=\"no\">--locale</code> option is required. The default output format is <code translate=\"no\">yaml</code>, saved in <code translate=\"no\">.yml</code> files (use <code translate=\"no\">--extension=yaml</code> for <code translate=\"no\">.yaml</code> files, or <code translate=\"no\">--format=po</code> for gettext PO format).</p>\n<p>The labels and descriptions of the <a href=\"../configuration/4-pages.md#translation-of-the-descriptions\">front matter schemas</a> are extracted too, into the <code translate=\"no\">schemas</code> file (e.g. <code translate=\"no\">schemas.fr.yml</code>).</p></aside>\n<aside class=\"note note-tip\"><p><a href=\"https://poedit.net\" target=\"_blank\" rel=\"noopener noreferrer\"><em>Poedit</em></a> is a simple and cross-platform translation editor for gettext (PO), and <a href=\"https://poedit.net/pro\" target=\"_blank\" rel=\"noopener noreferrer\"><em>Poedit Pro</em></a> supports extraction of translation strings from templates out of the box.</p></aside>\n<aside class=\"note note-important\"><p>Translations are <a href=\"6-cache.md\">cached</a>: the cache is refreshed when a translation file is updated or removed, but not when a new one is added.</p>\n<p>Cache can be cleared with the following command:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar cache:clear:translations</code></pre></aside>\n<h2 id=\"date-localization\">Date localization<a class=\"heading-anchor\" href=\"#date-localization\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Use the Twig <a href=\"https://twig.symfony.com/doc/3.x/filters/format_date.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code translate=\"no\">format_date</code></a> filter to localize a date in templates.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ page.<span class=\"hljs-name\">date</span>|format_date('long') }}</span><span class=\"xml\">\n</span><span class=\"hljs-comment\">{# September 30, 2022 #}</span></code></pre>\n<p>Supported values are: <code translate=\"no\">none</code>, <code translate=\"no\">short</code>, <code translate=\"no\">medium</code>, <code translate=\"no\">long</code>, and <code translate=\"no\">full</code>.</p>\n<p>The <a href=\"https://twig.symfony.com/doc/3.x/filters/format_datetime.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code translate=\"no\">format_datetime</code></a> and <a href=\"https://twig.symfony.com/doc/3.x/filters/format_time.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code translate=\"no\">format_time</code></a> filters are also available.</p>\n<aside class=\"note note-important\"><p>If you want to use these filters <strong>with locales other than \"en\"</strong>, you should <a href=\"https://php.net/intl.setup\" target=\"_blank\" rel=\"noopener noreferrer\">install the intl PHP extension</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/documentation/templates/cache/",
      "url": "https://cloudflare.cecil.app/documentation/templates/cache/",
      "title": "Cache",
      "summary": "Templates cache and fragments cache.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Cache\nCecil uses a cache system to speed up the generation process; it can be disabled or cleared.\nThere are three cache types involved in template rendering: templates, assets, and translations.\nClear cache\nYou can clear the cache with the following commands:\nphp cecil.phar cache:clear               # clear all caches\nphp cecil.phar cache:clear:assets        # clear assets cache\nphp cecil.phar cache:clear:templates     # clear templates cache\nphp cecil.phar cache:clear:translations  # clear translations cache\nIn practice you don’t need to clear the cache manually: Cecil does it for you when needed (e.g. when files change).\nFragments cache\nCecil provides a way to cache parts of templates rendering to avoid re-rendering the same partial content multiple times.\nTo use fragments cache, wrap the content you want to cache with the cache tag.\n{% cache 'unique-key' %}\n  {# cacheable content #}\n{% endcache %}\nYou should use the cache_key function to be sure to have a unique cache key for each content you want to cache.\nFragments cache is persistent, so if the cache key is too generic, you may end up with wrong content displayed.\nTo clear fragments cache only, use the following command:\nphp cecil.phar cache:clear:templates --fragments\nDisable cache\nYou can disable cache with the configuration.\nDisabling cache can slow down the generation process, so it’s not recommended.\nDuring local development, if you need to clear cache before each generation, you can use the following option:\nphp cecil.phar serve --clear-cache          # clear all caches\nphp cecil.phar serve --clear-cache=&lt;regex&gt;  # clear cache for cache keys matching the regular expression &lt;regex&gt;\nExample:\nphp cecil.phar serve --clear-cache=css  # clear cache for all CSS files",
      "content_html": "<h1>Cache</h1>\n<p>Cecil uses a cache system to speed up the generation process; it can be disabled or cleared.</p>\n<p>There are three cache types involved in template rendering: templates, <a href=\"../assets/index.md#asset\">assets</a>, and <a href=\"5-localization.md#translation-files\">translations</a>.</p>\n<h2 id=\"clear-cache\">Clear cache<a class=\"heading-anchor\" href=\"#clear-cache\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>You can clear the cache with the following commands:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar cache:clear               <span class=\"hljs-comment\"># clear all caches</span>\nphp cecil.phar cache:clear:assets        <span class=\"hljs-comment\"># clear assets cache</span>\nphp cecil.phar cache:clear:templates     <span class=\"hljs-comment\"># clear templates cache</span>\nphp cecil.phar cache:clear:translations  <span class=\"hljs-comment\"># clear translations cache</span></code></pre>\n<aside class=\"note note-important\"><p>In practice you don’t need to clear the cache manually: Cecil does it for you when needed (e.g. when files change).</p></aside>\n<h2 id=\"fragments-cache\">Fragments cache<a class=\"heading-anchor\" href=\"#fragments-cache\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Cecil provides a way to cache parts of templates rendering to avoid re-rendering the same partial content multiple times.</p>\n<p>To use <em>fragments</em> cache, wrap the content you want to cache with the <a href=\"https://twig.symfony.com/doc/tags/cache.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code translate=\"no\">cache</code> tag</a>.</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">cache</span> 'unique-key' %}</span><span class=\"xml\">\n  </span><span class=\"hljs-comment\">{# cacheable content #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endcache</span> %}</span></code></pre>\n<aside class=\"note note-tip\"><p>You should use the <a href=\"reference/1-functions.md#cache-key\"><code translate=\"no\">cache_key</code> function</a> to be sure to have a unique cache key for each content you want to cache.</p></aside>\n<aside class=\"note note-warning\"><p><em>Fragments</em> cache is persistent, so if the cache key is too generic, you may end up with wrong content displayed.</p></aside>\n<p>To clear fragments cache only, use the following command:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar cache:clear:templates --fragments</code></pre>\n<h2 id=\"disable-cache\">Disable cache<a class=\"heading-anchor\" href=\"#disable-cache\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>You can disable cache with the <a href=\"../configuration/9-cache.md\">configuration</a>.</p>\n<aside class=\"note note-warning\"><p>Disabling cache can slow down the generation process, so it’s not recommended.</p>\n<p>During local development, if you need to clear cache before each generation, you can use the following option:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar serve --clear-cache          <span class=\"hljs-comment\"># clear all caches</span>\nphp cecil.phar serve --clear-cache=&lt;regex&gt;  <span class=\"hljs-comment\"># clear cache for cache keys matching the regular expression &lt;regex&gt;</span></code></pre>\n<p>Example:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar serve --clear-cache=css  <span class=\"hljs-comment\"># clear cache for all CSS files</span></code></pre></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/documentation/templates/extend/",
      "url": "https://cloudflare.cecil.app/documentation/templates/extend/",
      "title": "Extend templates",
      "summary": "Add custom functions and filters, or use a theme.",
      "date_published": "2021-05-07T00:00:00+00:00",
      "date_modified": "2026-11-15T00:00:00+00:00","content_text": "Extend templates\nTemplates can be extended with custom functions and filters, or packaged as a reusable theme.\nFunctions and filters\nYou can add custom functions and custom filters with a Twig extension.\nTheme\nIt’s easy to build a theme: create a folder &lt;theme&gt; with the following structure (like a website but without pages):\n&lt;my-site&gt;\n└─ themes\n   └─ &lt;theme&gt;\n      ├─ config.yml\n      ├─ assets\n      ├─ layouts\n      ├─ schemas\n      ├─ static\n      └─ translations\nThen enable it with the theme configuration option.\nThe theme config.yml overrides the default configuration and is merged with the site configuration, which takes precedence, except for lists of values: the site values are added to the theme ones, and a theme value can only be removed with false (e.g. homepage: {atom: false}).\nThe schemas directory of the theme holds the front matter schemas of the variables its templates expect: the schemas of the site override them variable by variable.\nRequired themes\nA theme can require other themes (e.g. a component theme providing a search box, or a plugin) with the theme option of its config.yml:\n\/themes\/&lt;theme&gt;\/config.yml\ntheme:\n  - &lt;required-theme&gt;\nRequired themes are enabled with the theme, with no other configuration of the site: their layouts, assets, static files, translations, extensions and config.yml are loaded. They are added after the themes of the site, so the theme (like the site) overrides the themes it requires.\nRequired themes must be installed too, in the themes directory of the site: declare them as dependencies in the composer.json of the theme.",
      "content_html": "<h1>Extend templates</h1>\n<p>Templates can be extended with custom functions and filters, or packaged as a reusable theme.</p>\n<h2 id=\"functions-and-filters\">Functions and filters<a class=\"heading-anchor\" href=\"#functions-and-filters\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>You can add custom <a href=\"reference/1-functions.md\">functions</a> and custom <a href=\"reference/3-filters.md\">filters</a> with a <a href=\"../developers/1-extend.md#twig-extension\"><strong><em>Twig extension</em></strong></a>.</p>\n<h2 id=\"theme\">Theme<a class=\"heading-anchor\" href=\"#theme\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>It’s easy to build a theme: create a folder <code translate=\"no\">&lt;theme&gt;</code> with the following structure (like a website but without pages):</p>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">&lt;my-site&gt;\n└─ themes\n   └─ &lt;theme&gt;\n      ├─ config.yml\n      ├─ assets\n      ├─ layouts\n      ├─ schemas\n      ├─ static\n      └─ translations</code></pre>\n<p>Then enable it with the <a href=\"../configuration/1-site.md#theme\"><code translate=\"no\">theme</code></a> configuration option.</p>\n<p>The theme <code translate=\"no\">config.yml</code> overrides the <a href=\"../configuration/index.md#priority\">default configuration</a> and is merged with the site configuration, which takes precedence, except for <a href=\"../configuration/index.md#lists\">lists of values</a>: the site values are added to the theme ones, and a theme value can only be removed with <code translate=\"no\">false</code> (e.g. <code translate=\"no\">homepage: {atom: false}</code>).</p>\n<p>The <code translate=\"no\">schemas</code> directory of the theme holds the <a href=\"../configuration/4-pages.md#schemas-directory\">front matter schemas</a> of the variables its templates expect: the schemas of the site override them variable by variable.</p>\n<h3 id=\"required-themes\">Required themes<a class=\"heading-anchor\" href=\"#required-themes\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>A theme can require other themes (e.g. a component theme providing a search box, or a <a href=\"../developers/1-extend.md#plugins\">plugin</a>) with the <code translate=\"no\">theme</code> option of its <code translate=\"no\">config.yml</code>:</p>\n<p><em>/themes/&lt;theme&gt;/config.yml</em></p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">theme:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">&lt;required-theme&gt;</span></code></pre>\n<p>Required themes are enabled with the theme, with no other configuration of the site: their layouts, assets, static files, translations, extensions and <code translate=\"no\">config.yml</code> are loaded. They are added after the themes of the site, so the theme (like the site) overrides the themes it requires.</p>\n<aside class=\"note note-important\"><p>Required themes must be installed too, in the <code translate=\"no\">themes</code> directory of the site: declare them as dependencies in the <code translate=\"no\">composer.json</code> of the theme.</p></aside>",
      "language": "en"
    }
  ]
}
