{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "Cecil - Templates",
  "home_page_url": "https://cloudflare.cecil.app/fr/documentation/templates/",
  "feed_url": "https://cloudflare.cecil.app/fr/documentation/templates/feed.json",
  "description": "Travaillez avec les layouts, templates et composants Twig.",
  "icon": "https://cloudflare.cecil.app/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "favicon": "https://cloudflare.cecil.app/thumbnails/64x/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "language": "fr",
  "items": [
    {
      "id": "https://cloudflare.cecil.app/fr/documentation/templates/regles-de-recherche/",
      "url": "https://cloudflare.cecil.app/fr/documentation/templates/regles-de-recherche/",
      "title": "Organisation et règles de recherche",
      "summary": "Types de templates, convention de nommage, templates intégrés et choix du template d’une page.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Organisation et règles de recherche\nCecil génère les pages à l’aide de templates Twig : cette page explique comment les templates sont organisés et comment le bon template est choisi pour chaque page.\nOrganisation des fichiers\nTypes de templates\nIl existe trois types de templates : les layouts, les composants et les autres templates. Les layouts sont utilisés pour générer les pages, et chacun d’eux peut inclure des templates et des composants.\nConvention de nommage\nLes fichiers templates sont stockés dans le répertoire layouts\/ et doivent être nommés selon la convention suivante :\nlayouts\/(&lt;section&gt;\/)&lt;type&gt;|&lt;layout&gt;.&lt;format&gt;(.&lt;language&gt;).twig\n\n&lt;section&gt; (facultatif)\nLa section de la page (ex. : blog).\n&lt;type&gt;\nLe type de template : home (ou index) pour la homepage, list pour les pages de liste (homepage et sections), page pour une page, etc. (voir Règles de recherche pour plus de détails).\n&lt;layout&gt; (facultatif)\nLe nom du layout personnalisé défini dans le front matter de la page (ex. : layout: my-layout).\n&lt;format&gt;\nLe format de sortie de la page générée (ex. : html, rss, json, xml, etc.).\n&lt;language&gt; (facultatif)\nLa langue de la page (ex. : fr).\n\nExemples :\nlayouts\/home.html.twig       # `type` est \"homepage\"\nlayouts\/page.html.twig       # `type` est \"page\"\nlayouts\/page.html.fr.twig    # `type` est \"page\" et `language` est \"fr\"\nlayouts\/my-layout.html.twig  # `layout` est \"my-layout\"\nlayouts\/blog\/list.html.twig  # `section` est \"blog\"\nlayouts\/blog\/list.rss.twig   # `section` est \"blog\" et `format` est \"rss\"\n&lt;mon-site&gt;\n├─ ...\n├─ layouts\n|  ├─ index.html.twig      # Utilisé par le type \"homepage\"\n|  ├─ list.html.twig       # Utilisé par les types \"homepage\" et \"section\"\n|  ├─ list.rss.twig        # Utilisé par les types \"homepage\" et \"section\", pour le format de sortie RSS\n|  ├─ page.html.twig       # Utilisé par le type \"page\"\n|  ├─ taxonomy\n|  |  ├─ tags.html.twig    # Utilisé par le type \"vocabulary\" de `tags` (liste des termes)\n|  |  └─ tag.html.twig     # Utilisé par le type \"term\" de `tags` (liste des pages)\n|  ├─ my-layout.html.twig  # Utilisé par les pages avec `layout: my-layout` dans le front matter\n|  ├─ ...\n|  └─ partials             # Templates inclus\n|     ├─ footer.html.twig\n|     └─ ...\n└─ themes                  # Layouts et templates des thèmes\n   └─ ...\nTemplates intégrés\nCecil est livré avec un ensemble de templates intégrés.\nSi vous avez besoin de modifier des templates intégrés, vous pouvez facilement les extraire via la commande suivante : ils seront copiés dans le répertoire layouts de votre site.\nphp cecil.phar util:templates:extract\nRègles de recherche\nDans la plupart des cas, vous n’avez pas besoin de préciser le layout : Cecil sélectionne le layout le plus approprié, en fonction du type de la page.\nPar exemple, la sortie HTML de la page d’accueil (index.md) sera générée :\n\navec my-layout.html.twig si la variable layout est définie à « my-layout » (dans le front matter)\nsinon, avec index.html.twig si le fichier existe\nsinon, avec home.html.twig si le fichier existe\nsinon, avec list.html.twig si le fichier existe\n\nToutes les règles sont détaillées ci-dessous, pour chaque type de page, par ordre de priorité.\nChaque template candidat est recherché dans le répertoire layouts\/ du site, puis dans le répertoire layouts\/ de chaque thème (dans l’ordre configuré), puis dans les templates intégrés. Le premier fichier trouvé est utilisé.\nPour une page dans une autre langue que la langue par défaut, la variante localisée de chaque candidat (ex. : page.html.fr.twig) est essayée en premier : tous les candidats localisés sont recherchés avant les candidats non localisés.\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 et section\/&lt;parent&gt;.&lt;format&gt;.twig, pour chaque section parente d’une sous-section (la plus proche en premier)\n_default\/section.&lt;format&gt;.twig\nlist.&lt;format&gt;.twig\n_default\/list.&lt;format&gt;.twig\n\nLa &lt;section&gt; d’une sous-section est son chemin complet (ex. : blog\/2024), et une sous-section se replie sur les templates de ses sections parentes : si blog\/2024\/list.html.twig n’existe pas, la sous-section blog\/2024 est générée avec blog\/list.html.twig.\nLe nom utilisé comme &lt;section&gt; (pour une section et ses pages) peut être associé aux layouts d’une autre section avec l’option layouts.sections.\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\nLe template du vocabulaire est nommé d’après le pluriel (ex. : taxonomy\/categories.html.twig pour \/categories\/), tandis que le template d’un terme est nommé d’après le singulier (ex. : taxonomy\/category.html.twig pour \/categories\/data-sovereignty\/).\n&lt;term&gt; est le nom du terme « slugifié » : un template dédié au terme « Data Sovereignty » du vocabulaire categories est taxonomy\/categories\/data-sovereignty.html.twig.\nLa plupart de ces layouts sont disponibles par défaut (dans _default\/), voir templates intégrés.",
      "content_html": "<h1>Organisation et règles de recherche</h1>\n<p>Cecil génère les pages à l’aide de templates Twig : cette page explique comment les templates sont organisés et comment le bon template est choisi pour chaque page.</p>\n<h2 id=\"organisation-des-fichiers\">Organisation des fichiers<a class=\"heading-anchor\" href=\"#organisation-des-fichiers\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<h3 id=\"types-de-templates\">Types de templates<a class=\"heading-anchor\" href=\"#types-de-templates\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Il existe trois types de templates : les <strong><em>layouts</em></strong>, les <strong><em>composants</em></strong> et les <strong><em>autres templates</em></strong>. Les <em>layouts</em> sont utilisés pour générer les <a href=\"../content/1-pages.fr.md\">pages</a>, et chacun d’eux peut <a href=\"https://twig.symfony.com/doc/templates.html#including-other-templates\" target=\"_blank\" rel=\"noopener noreferrer\">inclure des templates</a> et des <a href=\"4-components.fr.md\">composants</a>.</p>\n<h3 id=\"convention-de-nommage\">Convention de nommage<a class=\"heading-anchor\" href=\"#convention-de-nommage\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Les fichiers templates sont stockés dans le répertoire <code translate=\"no\">layouts/</code> et doivent être nommés selon la convention suivante :</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>facultatif</em>)</dt>\n<dd>La section de la page (ex. : <code translate=\"no\">blog</code>).</dd>\n<dt><code translate=\"no\">&lt;type&gt;</code></dt>\n<dd>Le type de template : <code translate=\"no\">home</code> (ou <code translate=\"no\">index</code>) pour la <em>homepage</em>, <code translate=\"no\">list</code> pour les pages de liste (<em>homepage</em> et <em>sections</em>), <code translate=\"no\">page</code> pour une <em>page</em>, etc. (voir <a href=\"#regles-de-recherche\"><em>Règles de recherche</em></a> pour plus de détails).</dd>\n<dt><code translate=\"no\">&lt;layout&gt;</code> (<em>facultatif</em>)</dt>\n<dd>Le nom du layout personnalisé défini dans le <a href=\"../content/1-pages.fr.md#front-matter\">front matter</a> de la page (ex. : <code translate=\"no\">layout: my-layout</code>).</dd>\n<dt><code translate=\"no\">&lt;format&gt;</code></dt>\n<dd>Le <a href=\"../configuration/8-output.fr.md#output-formats\">format de sortie</a> de la page générée (ex. : <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>facultatif</em>)</dt>\n<dd>La langue de la page (ex. : <code translate=\"no\">fr</code>).</dd>\n</dl>\n<p><em>Exemples :</em></p>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">layouts/home.html.twig       # `type` est \"homepage\"\nlayouts/page.html.twig       # `type` est \"page\"\nlayouts/page.html.fr.twig    # `type` est \"page\" et `language` est \"fr\"\nlayouts/my-layout.html.twig  # `layout` est \"my-layout\"\nlayouts/blog/list.html.twig  # `section` est \"blog\"\nlayouts/blog/list.rss.twig   # `section` est \"blog\" et `format` est \"rss\"</code></pre>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">&lt;mon-site&gt;\n├─ ...\n├─ layouts\n|  ├─ index.html.twig      # Utilisé par le type \"homepage\"\n|  ├─ list.html.twig       # Utilisé par les types \"homepage\" et \"section\"\n|  ├─ list.rss.twig        # Utilisé par les types \"homepage\" et \"section\", pour le format de sortie RSS\n|  ├─ page.html.twig       # Utilisé par le type \"page\"\n|  ├─ taxonomy\n|  |  ├─ tags.html.twig    # Utilisé par le type \"vocabulary\" de `tags` (liste des termes)\n|  |  └─ tag.html.twig     # Utilisé par le type \"term\" de `tags` (liste des pages)\n|  ├─ my-layout.html.twig  # Utilisé par les pages avec `layout: my-layout` dans le front matter\n|  ├─ ...\n|  └─ partials             # Templates inclus\n|     ├─ footer.html.twig\n|     └─ ...\n└─ themes                  # Layouts et templates des thèmes\n   └─ ...</code></pre>\n<h3 id=\"templates-integres\">Templates intégrés<a class=\"heading-anchor\" href=\"#templates-integres\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Cecil est livré avec un ensemble de <a href=\"https://github.com/Cecilapp/Cecil/tree/main/resources/layouts\" target=\"_blank\" rel=\"noopener noreferrer\">templates intégrés</a>.</p>\n<aside class=\"note note-tip\"><p>Si vous avez besoin de modifier des templates intégrés, vous pouvez facilement les extraire via la commande suivante : ils seront copiés dans le répertoire <code translate=\"no\">layouts</code> de votre 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=\"regles-de-recherche\">Règles de recherche<a class=\"heading-anchor\" href=\"#regles-de-recherche\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Dans la plupart des cas, <strong>vous n’avez pas besoin de préciser le layout</strong> : Cecil sélectionne le layout le plus approprié, en fonction du <strong>type de la page</strong>.</p>\n<p>Par exemple, la sortie HTML de la <strong>page d’accueil</strong> (<code translate=\"no\">index.md</code>) sera générée :</p>\n<ol>\n<li>avec <code translate=\"no\">my-layout.html.twig</code> si la variable <code translate=\"no\">layout</code> est définie à « my-layout » (dans le front matter)</li>\n<li>sinon, avec <code translate=\"no\">index.html.twig</code> si le fichier existe</li>\n<li>sinon, avec <code translate=\"no\">home.html.twig</code> si le fichier existe</li>\n<li>sinon, avec <code translate=\"no\">list.html.twig</code> si le fichier existe</li>\n</ol>\n<p>Toutes les règles sont détaillées ci-dessous, pour chaque type de page, par ordre de priorité.</p>\n<aside class=\"note note-info\"><p>Chaque template candidat est recherché dans le répertoire <code translate=\"no\">layouts/</code> du site, puis dans le répertoire <code translate=\"no\">layouts/</code> de chaque <a href=\"7-extend.fr.md#theme\">thème</a> (dans l’ordre configuré), puis dans les templates intégrés. Le premier fichier trouvé est utilisé.</p></aside>\n<aside class=\"note note-tip\"><p>Pour une page dans une autre langue que la langue par défaut, la variante localisée de chaque candidat (ex. : <code translate=\"no\">page.html.fr.twig</code>) est essayée en premier : tous les candidats localisés sont recherchés avant les candidats non localisés.</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> et <code translate=\"no\">section/&lt;parent&gt;.&lt;format&gt;.twig</code>, pour chaque section parente d’une sous-section (la plus proche en premier)</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>La <code translate=\"no\">&lt;section&gt;</code> d’une <a href=\"../content/1-pages.fr.md#sous-section\">sous-section</a> est son chemin complet (ex. : <code translate=\"no\">blog/2024</code>), et une sous-section se replie sur les templates de ses sections parentes : si <code translate=\"no\">blog/2024/list.html.twig</code> n’existe pas, la sous-section <code translate=\"no\">blog/2024</code> est générée avec <code translate=\"no\">blog/list.html.twig</code>.</p></aside>\n<aside class=\"note note-info\"><p>Le nom utilisé comme <code translate=\"no\">&lt;section&gt;</code> (pour une section et ses pages) peut être associé aux layouts d’une autre section avec l’option <a href=\"../configuration/7-layouts.fr.md#layouts-sections\"><code translate=\"no\">layouts.sections</code></a>.</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>Le template du <strong>vocabulaire</strong> est nommé d’après le <strong>pluriel</strong> (ex. : <code translate=\"no\">taxonomy/categories.html.twig</code> pour <code translate=\"no\">/categories/</code>), tandis que le template d’un <strong>terme</strong> est nommé d’après le <strong>singulier</strong> (ex. : <code translate=\"no\">taxonomy/category.html.twig</code> pour <code translate=\"no\">/categories/data-sovereignty/</code>).</p></aside>\n<aside class=\"note note-tip\"><p><code translate=\"no\">&lt;term&gt;</code> est le nom du terme « slugifié » : un template dédié au terme « Data Sovereignty » du vocabulaire <code translate=\"no\">categories</code> est <code translate=\"no\">taxonomy/categories/data-sovereignty.html.twig</code>.</p></aside>\n<aside class=\"note note-info\"><p>La plupart de ces layouts sont disponibles par défaut (dans <code translate=\"no\">_default/</code>), voir <a href=\"#templates-integres\">templates intégrés</a>.</p></aside>",
      "language": "fr"
    },
    {
      "id": "https://cloudflare.cecil.app/fr/documentation/templates/reference/fonctions/",
      "url": "https://cloudflare.cecil.app/fr/documentation/templates/reference/fonctions/",
      "title": "Fonctions",
      "summary": "url, html, readtime, hash, cache_key, getenv, dump, tests, etc.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-10-22T00:00:00+00:00","content_text": "Fonctions\n\nLes fonctions peuvent être appelées pour générer du contenu. Les fonctions sont appelées par leur nom suivi de parenthèses (()) et peuvent avoir des arguments.\n\nVoir aussi : les fonctions dédiées aux assets (asset, integrity, image_srcset, image_sizes, image_from_website, etc.) sont documentées dans la section Assets.\nurl\nCrée une URL valide pour une page, une entrée de menu, un asset, un ID de page ou un chemin.\n{{ url(value, {options}) }}\n\n\n\nOption\nDescription\nType\nPar défaut\n\n\n\n\ncanonical\nPréfixe l’URL avec baseurl ou utilise canonical.url s’il existe.\nbooléen\nvaleur de canonicalurl (false par défaut)\n\n\nformat\nDéfinit le format de sortie de la page (ex. : json).\nchaîne\nhtml\n\n\nlanguage\nDéfinit la langue de la page (ex. : fr).\nchaîne\nlangue actuelle\n\n\n\nExemples :\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) }}\nPour plus de commodité, la fonction url est également disponible sous forme de filtre :\n{# page #}\n{{ page|url }}\n{{ page|url({canonical: true, format: 'json', language: 'fr'}) }}\n{# asset #}\n{{ asset('styles.css')|url }}\nLorsque la valeur est une chaîne, url() la « slugifie » pour trouver un ID de page correspondant (ex. : url('tags\/My Tag') retourne l’URL de la page tags\/my-tag). Si aucune page ne correspond, la chaîne est conservée comme chemin, avec les caractères invalides (ex. : espaces) encodés.\nhtml\nCrée un élément HTML à partir d’un asset (ou d’un tableau d’assets avec des attributs personnalisés).\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\nAjoute le couple name=\"value\" à l’élément HTML.\ntableau\n\n\noptions\n{preload: boolean} : précharge.Pour les images :{formats: array} : ajoute des formats alternatifs.{responsive: bool|string} : ajoute des images responsives (basées sur la largeur, width, ou la densité de pixels, density).{placeholder: string} : remplit l’arrière-plan de l’image avant son chargement (color ou lqip).\ntableau\n\n\n\nDepuis la version 8.42.0, la fonction html remplace le filtre html obsolète.\nVous pouvez définir un comportement global par défaut des options d’images (formats, responsive et placeholder) via la configuration des layouts.\nLorsque layouts.images.dark_suffix est configuré (par exemple .dark), Cecil recherche automatiquement une variante sombre de chaque image (par exemple photo.dark.jpg aux côtés de photo.jpg) et génère un élément &lt;picture&gt; avec un &lt;source media=\"(prefers-color-scheme: dark)\"&gt;.\nDe la même manière, lorsque layouts.images.mobile_suffix est configuré (par exemple .mobile), Cecil recherche une variante mobile de chaque image (par exemple photo.mobile.jpg) et ajoute un &lt;source&gt; avec la media query layouts.images.mobile_media_query. Si une variante sombre de l’image mobile existe (par exemple photo.mobile.dark.jpg), elle est utilisée sur mobile en mode sombre.\nExemples :\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')) }}\nPour plus de commodité, la fonction html reste disponible en tant que filtre (obsolète) :\n{{ asset|html({attributes}, {options}) }}\nreadtime\nDétermine le temps de lecture d’un texte, en minutes (sur la base de 200 mots par minute, 1 minute minimum).\n{{ readtime(value) }}\nExemple :\n{{ readtime(page.content) }} min\nhash\nCalcule le hachage d’un objet, d’un tableau ou d’une chaîne avec un algorithme donné.\n{{ hash(value, algorithm) }}\nalgorithm peut être n’importe quel algorithme pris en charge par la fonction hash() de PHP (ex. : md5, sha256, etc.). La valeur par défaut est xxh128.\nExemple :\n{{ hash('my string', 'sha256') }}\ncache_key\nCalcule une clé pour le cache de fragments en fonction d’un nom et d’une valeur facultative.\n{% cache cache_key(name, value) %}\n  {# cacheable content #}\n{% endcache %}\nLa fonction ajoute au nom un hachage de la valeur (qui peut être une chaîne, un tableau ou un objet), ainsi que la langue actuelle et l’ID de génération, pour garantir que la clé de cache générée est unique : si la valeur change, la clé de cache change aussi et une nouvelle entrée de cache est générée.\ngetenv\nObtient la valeur d’une variable d’environnement à partir de sa clé.\n{{ getenv(var) }}\nExemple :\n{{ getenv('VAR') }}\ndump\nLa fonction dump affiche les informations sur une variable de template. C’est surtout utile pour déboguer un template qui ne se comporte pas comme prévu, en inspectant ses variables :\n{{ dump(user) }}\nLe mode debug doit être activé.\nd\nLa fonction d() est la version HTML de dump() et utilise le composant Symfony VarDumper en arrière-plan.\n{{ d(variable, {theme: 'dark'}) }}\n\nSi variable n’est pas fournie, la fonction affiche le contexte Twig actuel\nLes thèmes disponibles sont light (par défaut) et dark\n\nLe mode debug doit être activé.\nTests\nLes tests s’utilisent avec l’opérateur is.\n\n\n\nTest\nDescription\n\n\n\n\nasset\nLa variable est un asset.\n\n\nimage_large\nL’asset est une image au format paysage d’au moins 600 × 315 pixels (ex. : une image de couverture).\n\n\nimage_square\nL’asset est une image carrée (largeur et hauteur identiques).\n\n\nenabled\nL’option est activée : true, un tableau associatif sans clé enabled ou avec enabled: true, ou toute autre valeur sauf false et null.\n\n\nexternal\nL’URL (ou l’URL d’une entrée de menu) est externe : elle a un schéma (https:, mailto:, etc.) ou commence par \/\/, et ne commence pas par baseurl.\n\n\n\nExemple :\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` et `cache: {enabled: false}` sont tous deux désactivés #}\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 %}\nLe test enabled ne vérifie que la valeur donnée, pas ses parents : config.optimize.html is enabled peut être vrai alors que optimize est désactivé.\nUne option personnalisée peut ne pas exister : utilisez le filtre default (ex. config.myoption|default(false) is enabled).\nObsolètes\nLes fonctions suivantes sont obsolètes (un avertissement de dépréciation est émis lorsqu’elles sont utilisées) :\n\n\n\nFonction\nRemplacement\n\n\n\n\nminify()\nfiltre minify\n\n\ntoCSS()\nfiltre to_css\n\n\nimage_from_url()\nfonction image_from_website()\n\n\n",
      "content_html": "<h1>Fonctions</h1>\n<blockquote>\n<p>Les <a href=\"https://twig.symfony.com/doc/functions/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">fonctions</a> peuvent être appelées pour générer du contenu. Les fonctions sont appelées par leur nom suivi de parenthèses (<code translate=\"no\">()</code>) et peuvent avoir des arguments.</p>\n</blockquote>\n<aside class=\"note note-info\"><p>Voir aussi : les fonctions dédiées aux 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.) sont documentées dans la section <a href=\"../../assets/index.fr.md\">Assets</a>.</p></aside>\n<h2 id=\"url\">url<a class=\"heading-anchor\" href=\"#url\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Crée une URL valide pour une page, une entrée de menu, un asset, un ID de page ou un chemin.</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>Par défaut</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>canonical</td>\n<td>Préfixe l’URL avec <a href=\"../../configuration/1-site.fr.md#baseurl\"><code translate=\"no\">baseurl</code></a> ou utilise <a href=\"../../configuration/1-site.fr.md#options-metatags\"><code translate=\"no\">canonical.url</code></a> s’il existe.</td>\n<td>booléen</td>\n<td>valeur de <a href=\"../../configuration/1-site.fr.md#canonicalurl\"><code translate=\"no\">canonicalurl</code></a> (<code translate=\"no\">false</code> par défaut)</td>\n</tr>\n<tr>\n<td>format</td>\n<td>Définit le <a href=\"../../configuration/8-output.fr.md#output-formats\">format de sortie</a> de la page (ex. : <code translate=\"no\">json</code>).</td>\n<td>chaîne</td>\n<td><code translate=\"no\">html</code></td>\n</tr>\n<tr>\n<td>language</td>\n<td>Définit la <a href=\"../../configuration/2-languages.fr.md#language\">langue</a> de la page (ex. : <code translate=\"no\">fr</code>).</td>\n<td>chaîne</td>\n<td>langue actuelle</td>\n</tr>\n</tbody>\n</table>\n<p><em>Exemples :</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>Pour plus de commodité, la fonction <code translate=\"no\">url</code> est également disponible sous forme de filtre :</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>Lorsque la valeur est une chaîne, <code translate=\"no\">url()</code> la « slugifie » pour trouver un ID de page correspondant (ex. : <code translate=\"no\">url('tags/My Tag')</code> retourne l’URL de la page <code translate=\"no\">tags/my-tag</code>). Si aucune page ne correspond, la chaîne est conservée comme chemin, avec les caractères invalides (ex. : espaces) encodés.</p></aside>\n<h2 id=\"html\">html<a class=\"heading-anchor\" href=\"#html\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Crée un élément HTML à partir d’un asset (ou d’un tableau d’assets avec des attributs personnalisés).</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>Ajoute le couple <code translate=\"no\">name=\"value\"</code> à l’élément HTML.</td>\n<td>tableau</td>\n</tr>\n<tr>\n<td>options</td>\n<td><code translate=\"no\">{preload: boolean}</code> : précharge.<br>Pour les images :<br><code translate=\"no\">{formats: array}</code> : ajoute des formats alternatifs.<br><code translate=\"no\">{responsive: bool|string}</code> : ajoute des images responsives (basées sur la largeur, <code translate=\"no\">width</code>, ou la densité de pixels, <code translate=\"no\">density</code>).<br><code translate=\"no\">{placeholder: string}</code> : remplit l’arrière-plan de l’image avant son chargement (<code translate=\"no\">color</code> ou <code translate=\"no\">lqip</code>).</td>\n<td>tableau</td>\n</tr>\n</tbody>\n</table>\n<aside class=\"note note-warning\"><p>Depuis la version <ins>8.42.0</ins>, la fonction <code translate=\"no\">html</code> remplace le filtre <code translate=\"no\">html</code> obsolète.</p></aside>\n<aside class=\"note note-tip\"><p>Vous pouvez définir un comportement global par défaut des options d’images (<code translate=\"no\">formats</code>, <code translate=\"no\">responsive</code> et <code translate=\"no\">placeholder</code>) via la <a href=\"../../configuration/7-layouts.fr.md#layouts-images\">configuration des layouts</a>.</p>\n<p>Lorsque <a href=\"../../configuration/7-layouts.fr.md#layouts-images\"><code translate=\"no\">layouts.images.dark_suffix</code></a> est configuré (par exemple <code translate=\"no\">.dark</code>), Cecil recherche automatiquement une variante sombre de chaque image (par exemple <code translate=\"no\">photo.dark.jpg</code> aux côtés de <code translate=\"no\">photo.jpg</code>) et génère un élément <code translate=\"no\">&lt;picture&gt;</code> avec un <code translate=\"no\">&lt;source media=\"(prefers-color-scheme: dark)\"&gt;</code>.</p>\n<p>De la même manière, lorsque <a href=\"../../configuration/7-layouts.fr.md#layouts-images\"><code translate=\"no\">layouts.images.mobile_suffix</code></a> est configuré (par exemple <code translate=\"no\">.mobile</code>), Cecil recherche une variante mobile de chaque image (par exemple <code translate=\"no\">photo.mobile.jpg</code>) et ajoute un <code translate=\"no\">&lt;source&gt;</code> avec la media query <a href=\"../../configuration/7-layouts.fr.md#layouts-images\"><code translate=\"no\">layouts.images.mobile_media_query</code></a>. Si une variante sombre de l’image mobile existe (par exemple <code translate=\"no\">photo.mobile.dark.jpg</code>), elle est utilisée sur mobile en mode sombre.</p></aside>\n<p><em>Exemples :</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>Pour plus de commodité, la fonction <code translate=\"no\">html</code> reste disponible en tant que filtre (obsolète) :</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>Détermine le temps de lecture d’un texte, en minutes (sur la base de 200 mots par 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>Exemple :</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>Calcule le hachage d’un objet, d’un tableau ou d’une chaîne avec un algorithme donné.</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> peut être n’importe quel algorithme pris en charge par la fonction <code translate=\"no\">hash()</code> de PHP (ex. : <code translate=\"no\">md5</code>, <code translate=\"no\">sha256</code>, etc.). La valeur par défaut est <code translate=\"no\">xxh128</code>.</p>\n<p><em>Exemple :</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>Calcule une clé pour le <a href=\"../6-cache.fr.md#cache-de-fragments\">cache de <em>fragments</em></a> en fonction d’un nom et d’une valeur facultative.</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>La fonction ajoute au nom un hachage de la valeur (qui peut être une chaîne, un tableau ou un objet), ainsi que la langue actuelle et l’ID de génération, pour garantir que la clé de cache générée est unique : si la valeur change, la clé de cache change aussi et une nouvelle entrée de cache est générée.</p>\n<h2 id=\"getenv\">getenv<a class=\"heading-anchor\" href=\"#getenv\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Obtient la valeur d’une variable d’environnement à partir de sa clé.</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>Exemple :</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>La fonction <code translate=\"no\">dump</code> affiche les informations sur une variable de template. C’est surtout utile pour déboguer un template qui ne se comporte pas comme prévu, en inspectant ses 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>Le <a href=\"../../configuration/1-site.fr.md#debug\"><em>mode debug</em></a> doit être activé.</p></aside>\n<h2 id=\"d\">d<a class=\"heading-anchor\" href=\"#d\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>La fonction <code translate=\"no\">d()</code> est la version HTML de <a href=\"#dump\"><code translate=\"no\">dump()</code></a> et utilise le <a href=\"https://symfony.com/doc/current/components/var_dumper.html\" target=\"_blank\" rel=\"noopener noreferrer\">composant Symfony VarDumper</a> en arrière-plan.</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>Si <em>variable</em> n’est pas fournie, la fonction affiche le contexte Twig actuel</li>\n<li>Les thèmes disponibles sont <code translate=\"no\">light</code> (par défaut) et <code translate=\"no\">dark</code></li>\n</ul>\n<aside class=\"note note-important\"><p>Le <a href=\"../../configuration/1-site.fr.md#debug\"><em>mode debug</em></a> doit être activé.</p></aside>\n<h2 id=\"tests\">Tests<a class=\"heading-anchor\" href=\"#tests\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Les <a href=\"https://twig.symfony.com/doc/tests/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">tests</a> s’utilisent avec l’opérateur <code translate=\"no\">is</code>.</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>La variable est un <a href=\"../../assets/index.fr.md#asset\">asset</a>.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">image_large</code></td>\n<td>L’asset est une image au format paysage d’au moins 600 × 315 pixels (ex. : une image de couverture).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">image_square</code></td>\n<td>L’asset est une image carrée (largeur et hauteur identiques).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">enabled</code></td>\n<td>L’option est activée : <code translate=\"no\">true</code>, un tableau associatif sans clé <code translate=\"no\">enabled</code> ou avec <code translate=\"no\">enabled: true</code>, ou toute autre valeur sauf <code translate=\"no\">false</code> et <code translate=\"no\">null</code>.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">external</code></td>\n<td>L’URL (ou l’URL d’une entrée de menu) est externe : elle a un schéma (<code translate=\"no\">https:</code>, <code translate=\"no\">mailto:</code>, etc.) ou commence par <code translate=\"no\">//</code>, et ne commence pas par <code translate=\"no\">baseurl</code>.</td>\n</tr>\n</tbody>\n</table>\n<p><em>Exemple :</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` et `cache: {enabled: false}` sont tous deux désactivés #}</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>Le test <code translate=\"no\">enabled</code> ne vérifie que la valeur donnée, pas ses parents : <code translate=\"no\">config.optimize.html is enabled</code> peut être vrai alors que <code translate=\"no\">optimize</code> est désactivé.\nUne option personnalisée peut ne pas exister : utilisez le filtre <code translate=\"no\">default</code> (ex. <code translate=\"no\">config.myoption|default(false) is enabled</code>).</p></aside>\n<h2 id=\"obsoletes\">Obsolètes<a class=\"heading-anchor\" href=\"#obsoletes\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Les fonctions suivantes sont obsolètes (un avertissement de dépréciation est émis lorsqu’elles sont utilisées) :</p>\n<table>\n<thead>\n<tr>\n<th>Fonction</th>\n<th>Remplacement</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">minify()</code></td>\n<td>filtre <a href=\"../../assets/2-processing.fr.md#minify\"><code translate=\"no\">minify</code></a></td>\n</tr>\n<tr>\n<td><code translate=\"no\">toCSS()</code></td>\n<td>filtre <a href=\"../../assets/2-processing.fr.md#to-css\"><code translate=\"no\">to_css</code></a></td>\n</tr>\n<tr>\n<td><code translate=\"no\">image_from_url()</code></td>\n<td>fonction <a href=\"../../assets/1-images.fr.md#image-from-website\"><code translate=\"no\">image_from_website()</code></a></td>\n</tr>\n</tbody>\n</table>",
      "language": "fr"
    },
    {
      "id": "https://cloudflare.cecil.app/fr/documentation/templates/variables/",
      "url": "https://cloudflare.cecil.app/fr/documentation/templates/variables/",
      "title": "Variables",
      "summary": "Variables disponibles dans les templates : site, page et cecil.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-10-19T00:00:00+00:00","content_text": "Variables\n\nL’application transmet des variables aux templates pour qu’ils puissent les manipuler. Les variables peuvent également avoir des attributs ou des éléments auxquels vous pouvez accéder.\nUtilisez un point (.) pour accéder aux attributs d’une variable : {{ foo.bar }}\n\nVous pouvez utiliser des variables de différentes portées : site, page, cecil.\nsite\nLa variable site contient des variables intégrées et celles définies dans la configuration.\n\n\n\nVariable\nDescription\n\n\n\n\nsite.pages\nCollection de toutes les pages, dans la langue actuelle.\n\n\nsite.allpages\nCollection de toutes les pages, dans toutes les langues.\n\n\nsite.page(id)\nLa page ayant l’ID donné.\n\n\nsite.taxonomies\nCollection des vocabulaires.\n\n\nsite.home\nID de la page d’accueil.\n\n\nsite.time\nTimestamp actuel.\n\n\nsite.debug\nÉtat du mode debug (true ou false).\n\n\nsite.build\nID de la génération actuelle.\n\n\n\nExemple :\ntitle: \"My amazing website!\"\nPeut être affiché dans un template avec :\n{{ site.title }}\nUtilisez la méthode showable sur une collection de pages pour ne renvoyer que les pages publiées, non paginées, non redirigées et non exclues (les pages générées, comme les sections ou les taxonomies, sont incluses).\nExemple :\n{% for page in site.pages.showable %}\n  &lt;a href=\"{{ url(page) }}\"&gt;{{ page.title }}&lt;\/a&gt;\n{% endfor %}\nDans certains cas, vous pouvez rencontrer des conflits entre la configuration et les variables intégrées (ex. : la configuration pages.default). Dans ce cas, vous pouvez utiliser config.&lt;variable&gt; (où &lt;variable&gt; est le nom\/chemin de la variable) pour accéder directement à la configuration brute.\nExemple :\n{{ config.pages.default.sitemap.priority }}\nsite.menus\nBouclez sur site.menus.&lt;menu&gt; pour obtenir chaque entrée de la collection &lt;menu&gt; (ex. : main).\n\n\n\nVariable\nDescription\n\n\n\n\n&lt;entry&gt;.id\nID de l’entrée (pour une entrée de page : l’ID de la page sans préfixe de langue).\n\n\n&lt;entry&gt;.name\nNom de l’entrée.\n\n\n&lt;entry&gt;.url\nURL de l’entrée.\n\n\n&lt;entry&gt;.weight\nPoids de l’entrée (utile pour trier les entrées de menu).\n\n\n\nExemple :\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\nInformations sur la langue actuelle.\n\n\n\nVariable\nDescription\n\n\n\n\nsite.language\nCode de langue (ex. : en).\n\n\nsite.language.name\nNom de la langue (ex. : English).\n\n\nsite.language.locale\nCode de locale de la langue (ex. : en_US).\n\n\nsite.language.weight\nPosition de la langue dans la liste languages.\n\n\n\nVous pouvez récupérer name, locale et weight d’une langue spécifique en passant son code en paramètre.\nPar exemple : site.language.name('fr').\nsite.static\nLa collection des fichiers statiques est accessible via site.static si le static load est activé.\nChaque fichier expose les propriétés suivantes :\n\nfile : chemin relatif du fichier, tel que trouvé dans le répertoire static\/ (ex. : images\/img-1.jpg)\npath : chemin relatif, avec des barres obliques (ex. : images\/img-1.jpg)\ndate : date de création (DateTime)\nupdated : date de modification (DateTime)\nname : nom (ex. : img-1.jpg)\nbasename : nom sans extension (ex. : img-1)\next : extension (ex. : jpg)\ntype : type de média (ex. : image)\nsubtype : sous-type de média (ex. : image\/jpeg)\nexif : données EXIF de l’image (array)\naudio : objet Mp3Info\nvideo : tableau d’informations vidéo de base (durée en secondes, largeur et hauteur)\n\nsite.data\nUne collection de données est accessible via site.data.&lt;filename&gt; (sans extension de fichier).\nExemples :\n\ndata\/authors.yml : site.data.authors\ndata\/authors.fr.yml : site.data.authors (si site.language = « fr »)\ndata\/galleries\/gallery-1.json : site.data.galleries['gallery-1']\n\npage\nLa variable page contient les variables intégrées d’une page et celles définies dans le front matter.\n\n\n\nVariable\nDescription\nExemple\n\n\n\n\npage.id\nIdentifiant unique.\nblog\/post-1\n\n\npage.title\nNom du fichier (sans extension).\nPost 1\n\n\npage.date\nDate de création du fichier.\nDateTime\n\n\npage.body\nCorps du fichier.\nMarkdown\n\n\npage.content\nCorps du fichier converti en HTML.\nHTML\n\n\npage.section\nDossier racine du fichier (slugifié).\nblog\n\n\npage.path\nChemin du fichier (slugifié).\nblog\/post-1\n\n\npage.slug\nNom du fichier (slugifié).\npost-1\n\n\npage.filepath\nChemin dans le système de fichiers.\nBlog\/Post 1.md\n\n\npage.type\nhomepage, page, section, vocabulary ou term.\npage\n\n\npage.pages\nCollection de toutes les sous-pages.\nCollection\n\n\npage.translations\nCollection des pages traduites.\nCollection\n\n\n\nUtilisez la méthode showable sur une collection de pages pour ne renvoyer que les pages publiées, non paginées, non redirigées et non exclues (les pages générées, comme les sections ou les taxonomies, sont incluses).\nExemple :\n{% for page in page.pages.showable %}\n  &lt;a href=\"{{ url(page) }}\"&gt;{{ page.title }}&lt;\/a&gt;\n{% endfor %}\nSections imbriquées\nDans un contexte de sections imbriquées, les propriétés page.parent, page.ancestors, page.sections et page.toplevel facilitent la construction de la navigation.\n\n\n\nVariable\nDescription\nExemple\n\n\n\n\npage.parent\nPage de la section parente (null si aucune).\nPage\n\n\npage.ancestors\nCollection des sections ancêtres (la plus proche en premier).\nCollection\n\n\npage.sections\nCollection des sections descendantes immédiates.\nCollection\n\n\npage.toplevel\ntrue si la page est une section de premier niveau.\nBoolean\n\n\n\nFil d’Ariane (de la page d’accueil à la page courante) :\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;\nUn partial breadcrumb.html.twig prêt à l’emploi est disponible :\n{{ include('partials\/breadcrumb.html.twig') }}\nMenu des sous-sections (sections descendantes immédiates de la section courante) :\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 %}\nNavigation principale limitée aux sections de premier niveau (depuis n’importe quelle 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;\nLien vers la section parente :\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 entre les pages d’une même Section, triées selon le sortby de la section (ordre chronologique pour les dates).\nAvec des sous-sections, la navigation suit l’arbre des sections : les pages d’une Section de premier niveau et de toutes ses sous-sections sont enchaînées, chaque sous-section (sa page d’index) étant placée parmi les pages de sa Section parente et suivie de ses propres pages.\n\n\n\nVariable\nDescription\nExemple\n\n\n\n\npage.prev\nPage précédente.\nPage\n\n\npage.next\nPage suivante.\nPage\n\n\n\nExemple :\n{% if page.prev is defined %}\n&lt;a href=\"{{ url(page.prev) }}\"&gt;{{ page.prev.title }}&lt;\/a&gt;\n{% endif %}\npage.paginator\nLe paginator vous aide à créer la navigation des pages de liste : page d’accueil, sections et taxonomies.\n\n\n\nVariable\nDescription\n\n\n\n\npage.paginator.pages\nCollection de pages.\n\n\npage.paginator.pages_total\nNombre total de pages.\n\n\npage.paginator.count\nNombre de pages du paginator.\n\n\npage.paginator.current\nIndex de position de la page actuelle.\n\n\npage.paginator.links.first\nID de la première page.\n\n\npage.paginator.links.prev\nID de la page précédente.\n\n\npage.paginator.links.self\nID de la page actuelle.\n\n\npage.paginator.links.next\nID de la page suivante.\n\n\npage.paginator.links.last\nID de la dernière page.\n\n\npage.paginator.links.path\nID de la page sans l’index de position.\n\n\n\nLes entrées de links étant des ID de page, vous devez utiliser la fonction url() pour créer des liens fonctionnels.\nPar exemple : {{ url(page.paginator.links.next) }}\nExemple :\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 %}\nExemple :\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 %}\nTaxonomie\nVariables disponibles dans les templates vocabulary et term.\nVocabulaire\nPage \/&lt;plural&gt;\/ (ex. : \/categories\/).\n\n\n\nVariable\nDescription\n\n\n\n\npage.plural\nNom du vocabulaire au pluriel.\n\n\npage.singular\nNom du vocabulaire au singulier.\n\n\npage.terms\nListe des termes (Collection).\n\n\n\nChaque terme de page.terms fournit term.id (identifiant du terme, ex. : categories\/php), term.name (nom du terme, ex. : PHP) et le nombre de ses pages avec term|length.\nTerme\nPage \/&lt;plural&gt;\/&lt;term&gt;\/ (ex. : \/categories\/php\/).\n\n\n\nVariable\nDescription\n\n\n\n\npage.title\nNom du terme.\n\n\npage.term\nIdentifiant du terme (ex. : categories\/php).\n\n\npage.plural\nNom du vocabulaire au pluriel.\n\n\npage.singular\nNom du vocabulaire au singulier.\n\n\npage.pages\nListe des pages de ce terme, triées par date (Collection).\n\n\n\nExemple de taxonomie\nConfiguration :\ntaxonomies:\n  categories: category\nFront matter d’une page :\n---\ncategories: [\"Data Sovereignty\"]\n---\nListe des termes (\/categories\/), dans 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 %}\nListe des pages d’un terme (\/categories\/data-sovereignty\/), dans 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;Toutes les {{ page.plural }}&lt;\/a&gt;\n{% endblock %}\nLiens vers les termes de la page courante, dans un template de page :\n{% for category in page.categories ?? [] %}\n  &lt;a href=\"{{ url('categories\/' ~ category) }}\"&gt;{{ category }}&lt;\/a&gt;\n{% endfor %}\nLa fonction url() « slugifie » la chaîne fournie pour trouver la page correspondante : url('categories\/Data Sovereignty') retourne \/categories\/data-sovereignty\/.\nVous pouvez aussi utiliser le partial intégré {{ include('partials\/terms-list.html.twig', {vocabulary: 'categories'}) }}.\ncecil\n\n\n\nVariable\nDescription\n\n\n\n\ncecil.url\nURL du site de Cecil.\n\n\ncecil.version\nVersion actuelle de Cecil.\n\n\ncecil.poweredby\nAffiche Cecil v%s, où %s est la version actuelle.\n\n\n",
      "content_html": "<h1>Variables</h1>\n<blockquote>\n<p>L’application transmet des variables aux templates pour qu’ils puissent les manipuler. Les variables peuvent également avoir des attributs ou des éléments auxquels vous pouvez accéder.\nUtilisez un point (.) pour accéder aux attributs d’une variable : <code translate=\"no\">{{ foo.bar }}</code></p>\n</blockquote>\n<p>Vous pouvez utiliser des variables de différentes portées : <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>La variable <code translate=\"no\">site</code> contient des variables intégrées <strong>et</strong> celles définies dans la <a href=\"../configuration/index.fr.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 de toutes les pages, dans la langue actuelle.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.allpages</code></td>\n<td>Collection de toutes les pages, dans toutes les langues.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.page(id)</code></td>\n<td>La page ayant l’ID donné.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.taxonomies</code></td>\n<td>Collection des vocabulaires.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.home</code></td>\n<td>ID de la page d’accueil.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.time</code></td>\n<td><a href=\"https://wikipedia.org/wiki/Unix_time\" target=\"_blank\" rel=\"noopener noreferrer\"><em>Timestamp</em></a> actuel.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.debug</code></td>\n<td>État du mode debug (<code translate=\"no\">true</code> ou <code translate=\"no\">false</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.build</code></td>\n<td>ID de la génération actuelle.</td>\n</tr>\n</tbody>\n</table>\n<p><em>Exemple :</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>Peut être affiché dans un template avec :</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>Utilisez la méthode <code translate=\"no\">showable</code> sur une collection de pages pour ne renvoyer que les pages publiées, non paginées, non redirigées et non exclues (les pages générées, comme les sections ou les taxonomies, sont incluses).</p>\n<p><em>Exemple :</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>Dans certains cas, vous pouvez rencontrer des conflits entre la configuration et les variables intégrées (ex. : la configuration <code translate=\"no\">pages.default</code>). Dans ce cas, vous pouvez utiliser <code translate=\"no\">config.&lt;variable&gt;</code> (où <code translate=\"no\">&lt;variable&gt;</code> est le nom/chemin de la variable) pour accéder directement à la configuration brute.</p>\n<p>Exemple :</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>Bouclez sur <code translate=\"no\">site.menus.&lt;menu&gt;</code> pour obtenir chaque entrée de la collection <code translate=\"no\">&lt;menu&gt;</code> (ex. : <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>ID de l’entrée (pour une entrée de page : l’ID de la page sans préfixe de langue).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">&lt;entry&gt;.name</code></td>\n<td>Nom de l’entrée.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">&lt;entry&gt;.url</code></td>\n<td>URL de l’entrée.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">&lt;entry&gt;.weight</code></td>\n<td>Poids de l’entrée (utile pour trier les entrées de menu).</td>\n</tr>\n</tbody>\n</table>\n<p><em>Exemple :</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>Informations sur la langue actuelle.</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>Code de langue (ex. : <code translate=\"no\">en</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.language.name</code></td>\n<td>Nom de la langue (ex. : <code translate=\"no\">English</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.language.locale</code></td>\n<td><a href=\"../configuration/3-locale-codes.fr.md\">Code de locale</a> de la langue (ex. : <code translate=\"no\">en_US</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">site.language.weight</code></td>\n<td>Position de la langue dans la liste <code translate=\"no\">languages</code>.</td>\n</tr>\n</tbody>\n</table>\n<aside class=\"note note-tip\"><p>Vous pouvez récupérer <code translate=\"no\">name</code>, <code translate=\"no\">locale</code> et <code translate=\"no\">weight</code> d’une langue spécifique en passant son code en paramètre.\nPar exemple : <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>La collection des fichiers statiques est accessible via <code translate=\"no\">site.static</code> si le <a href=\"../configuration/5-data-static.fr.md#static-load\"><em>static load</em></a> est activé.</p>\n<p>Chaque fichier expose les propriétés suivantes :</p>\n<ul>\n<li><code translate=\"no\">file</code> : chemin relatif du fichier, tel que trouvé dans le répertoire <code translate=\"no\">static/</code> (ex. : <code translate=\"no\">images/img-1.jpg</code>)</li>\n<li><code translate=\"no\">path</code> : chemin relatif, avec des barres obliques (ex. : <code translate=\"no\">images/img-1.jpg</code>)</li>\n<li><code translate=\"no\">date</code> : date de création (<em>DateTime</em>)</li>\n<li><code translate=\"no\">updated</code> : date de modification (<em>DateTime</em>)</li>\n<li><code translate=\"no\">name</code> : nom (ex. : <code translate=\"no\">img-1.jpg</code>)</li>\n<li><code translate=\"no\">basename</code> : nom sans extension (ex. : <code translate=\"no\">img-1</code>)</li>\n<li><code translate=\"no\">ext</code> : extension (ex. : <code translate=\"no\">jpg</code>)</li>\n<li><code translate=\"no\">type</code> : type de média (ex. : <code translate=\"no\">image</code>)</li>\n<li><code translate=\"no\">subtype</code> : sous-type de média (ex. : <code translate=\"no\">image/jpeg</code>)</li>\n<li><code translate=\"no\">exif</code> : données EXIF de l’image (<em>array</em>)</li>\n<li><code translate=\"no\">audio</code> : objet <a href=\"https://github.com/wapmorgan/Mp3Info#audio-information\" target=\"_blank\" rel=\"noopener noreferrer\">Mp3Info</a></li>\n<li><code translate=\"no\">video</code> : tableau d’informations vidéo de base (durée en secondes, largeur et hauteur)</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>Une collection de données est accessible via <code translate=\"no\">site.data.&lt;filename&gt;</code> (sans extension de fichier).</p>\n<p><em>Exemples :</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> (si <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>La variable <code translate=\"no\">page</code> contient les variables intégrées d’une page <strong>et</strong> celles définies dans le <a href=\"../content/1-pages.fr.md#front-matter\">front matter</a>.</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n<th>Exemple</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">page.id</code></td>\n<td>Identifiant unique.</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>Nom du fichier (sans 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>Date de création du fichier.</td>\n<td><em>DateTime</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.body</code></td>\n<td>Corps du fichier.</td>\n<td><em>Markdown</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.content</code></td>\n<td>Corps du fichier converti en HTML.</td>\n<td><em>HTML</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.section</code></td>\n<td>Dossier racine du fichier (<em>slugifié</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>Chemin du fichier (<em>slugifié</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>Nom du fichier (<em>slugifié</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>Chemin dans le système de fichiers.</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> ou <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 de toutes les sous-pages.</td>\n<td><em>Collection</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.translations</code></td>\n<td>Collection des pages traduites.</td>\n<td><em>Collection</em></td>\n</tr>\n</tbody>\n</table>\n<aside class=\"note note-important\"><p>Utilisez la méthode <code translate=\"no\">showable</code> sur une collection de pages pour ne renvoyer que les pages publiées, non paginées, non redirigées et non exclues (les pages générées, comme les sections ou les taxonomies, sont incluses).</p>\n<p><em>Exemple :</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=\"sections-imbriquees\">Sections imbriquées<a class=\"heading-anchor\" href=\"#sections-imbriquees\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Dans un contexte de <a href=\"../content/1-pages.fr.md#sous-section\">sections imbriquées</a>, les propriétés <code translate=\"no\">page.parent</code>, <code translate=\"no\">page.ancestors</code>, <code translate=\"no\">page.sections</code> et <code translate=\"no\">page.toplevel</code> facilitent la construction de la navigation.</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n<th>Exemple</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">page.parent</code></td>\n<td>Page de la <em>section</em> parente (<code translate=\"no\">null</code> si aucune).</td>\n<td><em>Page</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.ancestors</code></td>\n<td>Collection des <em>sections</em> ancêtres (la plus proche en premier).</td>\n<td><em>Collection</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.sections</code></td>\n<td>Collection des <em>sections</em> descendantes immédiates.</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> si la page est une <em>section</em> de premier niveau.</td>\n<td><em>Boolean</em></td>\n</tr>\n</tbody>\n</table>\n<p><em>Fil d’Ariane (de la page d’accueil à la page courante) :</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>Un partial <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> prêt à l’emploi est disponible :</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>Menu des sous-sections (sections descendantes immédiates de la section courante) :</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>Navigation principale limitée aux sections de premier niveau (depuis n’importe quelle 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>Lien vers la section parente :</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 entre les pages d’une même <em>Section</em>, triées selon le <code translate=\"no\">sortby</code> de la section (ordre chronologique pour les dates).</p>\n<p>Avec des <a href=\"../content/1-pages.fr.md#sous-section\">sous-sections</a>, la navigation suit l’arbre des sections : les pages d’une <em>Section</em> de premier niveau et de toutes ses sous-sections sont enchaînées, chaque sous-section (sa page d’index) étant placée parmi les pages de sa <em>Section</em> parente et suivie de ses propres pages.</p>\n<table>\n<thead>\n<tr>\n<th>Variable</th>\n<th>Description</th>\n<th>Exemple</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code translate=\"no\">page.prev</code></td>\n<td>Page précédente.</td>\n<td><em>Page</em></td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.next</code></td>\n<td>Page suivante.</td>\n<td><em>Page</em></td>\n</tr>\n</tbody>\n</table>\n<p><em>Exemple :</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>Le <em>paginator</em> vous aide à créer la navigation des pages de liste : page d’accueil, sections et 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>Collection de pages.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.pages_total</code></td>\n<td>Nombre total de pages.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.count</code></td>\n<td>Nombre de pages du paginator.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.current</code></td>\n<td>Index de position de la page actuelle.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.first</code></td>\n<td>ID de la première page.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.prev</code></td>\n<td>ID de la page précédente.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.self</code></td>\n<td>ID de la page actuelle.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.next</code></td>\n<td>ID de la page suivante.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.last</code></td>\n<td>ID de la dernière page.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.paginator.links.path</code></td>\n<td>ID de la page sans l’index de position.</td>\n</tr>\n</tbody>\n</table>\n<aside class=\"note note-important\"><p>Les entrées de <code translate=\"no\">links</code> étant des ID de page, vous devez utiliser la fonction <code translate=\"no\">url()</code> pour créer des liens fonctionnels.\nPar exemple : <code translate=\"no\">{{ url(page.paginator.links.next) }}</code></p></aside>\n<p><em>Exemple :</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>Exemple :</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=\"taxonomie\">Taxonomie<a class=\"heading-anchor\" href=\"#taxonomie\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Variables disponibles dans les templates <em>vocabulary</em> et <em>term</em>.</p>\n<h4 id=\"vocabulaire\">Vocabulaire</h4>\n<p>Page <code translate=\"no\">/&lt;plural&gt;/</code> (ex. : <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>Nom du vocabulaire au pluriel.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.singular</code></td>\n<td>Nom du vocabulaire au singulier.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.terms</code></td>\n<td>Liste des termes (<em>Collection</em>).</td>\n</tr>\n</tbody>\n</table>\n<p>Chaque terme de <code translate=\"no\">page.terms</code> fournit <code translate=\"no\">term.id</code> (identifiant du terme, ex. : <code translate=\"no\">categories/php</code>), <code translate=\"no\">term.name</code> (nom du terme, ex. : <code translate=\"no\">PHP</code>) et le nombre de ses pages avec <code translate=\"no\">term|length</code>.</p>\n<h4 id=\"terme\">Terme</h4>\n<p>Page <code translate=\"no\">/&lt;plural&gt;/&lt;term&gt;/</code> (ex. : <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>Nom du terme.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.term</code></td>\n<td>Identifiant du terme (ex. : <code translate=\"no\">categories/php</code>).</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.plural</code></td>\n<td>Nom du vocabulaire au pluriel.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.singular</code></td>\n<td>Nom du vocabulaire au singulier.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">page.pages</code></td>\n<td>Liste des pages de ce terme, triées par date (<em>Collection</em>).</td>\n</tr>\n</tbody>\n</table>\n<h4 id=\"exemple-de-taxonomie\">Exemple de taxonomie</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>Front matter d’une page :</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>Liste des termes (<code translate=\"no\">/categories/</code>), dans <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>Liste des pages d’un terme (<code translate=\"no\">/categories/data-sovereignty/</code>), dans <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>Toutes les </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>Liens vers les termes de la page courante, dans un template de page :</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>La fonction <a href=\"reference/1-functions.fr.md#url\"><code translate=\"no\">url()</code></a> « slugifie » la chaîne fournie pour trouver la page correspondante : <code translate=\"no\">url('categories/Data Sovereignty')</code> retourne <code translate=\"no\">/categories/data-sovereignty/</code>.</p>\n<p>Vous pouvez aussi utiliser le partial intégré <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 du site de Cecil.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">cecil.version</code></td>\n<td>Version actuelle de Cecil.</td>\n</tr>\n<tr>\n<td><code translate=\"no\">cecil.poweredby</code></td>\n<td>Affiche <code translate=\"no\">Cecil v%s</code>, où <code translate=\"no\">%s</code> est la version actuelle.</td>\n</tr>\n</tbody>\n</table>",
      "language": "fr"
    },
    {
      "id": "https://cloudflare.cecil.app/fr/documentation/templates/reference/tris/",
      "url": "https://cloudflare.cecil.app/fr/documentation/templates/reference/tris/",
      "title": "Tris",
      "summary": "Triez des collections de pages, menus ou taxonomies.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Tris\nTri des collections (de pages, menus ou taxonomies).\nsort_by_title\nTrie une collection par titre (avec un tri naturel).\n{{ collection|sort_by_title }}\nExemple :\n{{ site.pages|sort_by_title }}\nsort_by_date\nTrie une collection par date (la plus récente en premier).\n{{ collection|sort_by_date(variable='date', desc_title=false) }}\n\nvariable : la variable de date utilisée pour le tri (date par défaut)\ndesc_title : trie les éléments ayant la même date par titre, dans l’ordre décroissant (false par défaut)\n\nExemple :\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\nTrie une collection par poids (le plus léger en premier).\n{{ collection|sort_by_weight }}\nExemple :\n{{ site.menus.main|sort_by_weight }}\nsort\nPour les cas plus complexes, il est préférable d’utiliser le filtre natif sort de Twig.\nExemple :\n{% set files = site.static|sort((a, b) =&gt; b.date &lt;=&gt; a.date) %}\nMéthodes de collection\nUne collection de pages (ex. : site.pages, page.pages) fournit également des méthodes de tri, qui renvoient une collection de pages :\n\nsortBy(options) : trie par date, updated, title ou weight\nsortByDate(options), sortByTitle(options), sortByWeight(options)\n\noptions peut être le nom de la variable (ex. : 'title') ou un objet avec les clés variable, descTitle (tri par date uniquement) et reverse.\nExemples :\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>Tris</h1>\n<p>Tri des collections (de pages, menus ou 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>Trie une collection par titre (avec un <a href=\"https://en.wikipedia.org/wiki/Natural_sort_order\" target=\"_blank\" rel=\"noopener noreferrer\">tri naturel</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>Exemple :</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>Trie une collection par date (la plus récente en premier).</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> : la variable de date utilisée pour le tri (<code translate=\"no\">date</code> par défaut)</li>\n<li><code translate=\"no\">desc_title</code> : trie les éléments ayant la même date par titre, dans l’ordre décroissant (<code translate=\"no\">false</code> par défaut)</li>\n</ul>\n<p><em>Exemple :</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>Trie une collection par poids (le plus léger en premier).</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>Exemple :</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>Pour les cas plus complexes, il est préférable d’utiliser le filtre natif <a href=\"https://twig.symfony.com/doc/filters/sort.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code translate=\"no\">sort</code></a> de Twig.</p>\n<p><em>Exemple :</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=\"methodes-de-collection\">Méthodes de collection<a class=\"heading-anchor\" href=\"#methodes-de-collection\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Une collection de pages (ex. : <code translate=\"no\">site.pages</code>, <code translate=\"no\">page.pages</code>) fournit également des méthodes de tri, qui renvoient une collection de pages :</p>\n<ul>\n<li><code translate=\"no\">sortBy(options)</code> : trie par <code translate=\"no\">date</code>, <code translate=\"no\">updated</code>, <code translate=\"no\">title</code> ou <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> peut être le nom de la variable (ex. : <code translate=\"no\">'title'</code>) ou un objet avec les clés <code translate=\"no\">variable</code>, <code translate=\"no\">descTitle</code> (tri par date uniquement) et <code translate=\"no\">reverse</code>.</p>\n<p><em>Exemples :</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": "fr"
    },
    {
      "id": "https://cloudflare.cecil.app/fr/documentation/templates/reference/filtres/",
      "url": "https://cloudflare.cecil.app/fr/documentation/templates/reference/filtres/",
      "title": "Filtres",
      "summary": "filter_by, markdown_to_html, toc, slugify, excerpt, highlight, preg_*, etc.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-11-15T00:00:00+00:00","content_text": "Filtres\nLes variables peuvent être modifiées par des filtres. Les filtres sont séparés de la variable par un symbole de barre verticale (|). Plusieurs filtres peuvent être chaînés. La sortie d’un filtre est appliquée au suivant.\n{{ page.title|truncate(25)|capitalize }}\nVoir aussi : les filtres dédiés aux assets (resize, minify, fingerprint, to_css, inline, webp, lqip, etc.) sont documentés dans la section Assets.\nfilter_by\nFiltre une collection de pages par nom\/valeur de variable.\n{{ collection|filter_by(variable, value) }}\nSeules les pages standards (de type page, hors redirections) sont renvoyées.\nExemple :\n{{ pages|filter_by('section', 'blog') }}\nfilter\nPour les cas plus complexes, il est préférable d’utiliser le filtre natif filter de Twig.\nExemple :\n{% set filtered = pages|filter(p =&gt; p.generated == false and p.id not in ['page-1', 'page-2']) %}\nmarkdown_to_html\nConvertit une chaîne Markdown en HTML.\n{{ markdown|markdown_to_html }}\n{% apply markdown_to_html %}\n{# Markdown here #}\n{% endapply %}\nExemples :\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\nExtrait uniquement les titres correspondant aux selectors donnés (h2, h3, etc.), ou à ceux définis dans la configuration pages.body.toc s’ils ne sont pas spécifiés.\nLe paramètre format définit le format de sortie : html (par défaut) ou json.\nLe paramètre url est utilisé pour créer les liens vers les titres.\n{{ markdown|toc(format, selectors, url) }}\nExemples :\n{{ page.body|toc }}\n{{ page.body|toc('html') }}\n{{ page.body|toc(selectors=['h2']) }}\n{{ page.body|toc(url=url(page)) }}\njson_decode\nConvertit une chaîne JSON en tableau.\n{{ json|json_decode }}\nExemple :\n{% set json = '{\"foo\": \"bar\"}' %}\n{% set array = json|json_decode %}\n{{ array.foo }}\nyaml_parse\nConvertit une chaîne YAML en tableau.\n{{ yaml|yaml_parse }}\nExemple :\n{% set yaml = 'key: value' %}\n{% set array = yaml|yaml_parse %}\n{{ array.key }}\nslugify\nConvertit une chaîne en slug.\n{{ string|slugify }}\nu\nLe filtre u enveloppe un texte dans un objet Unicode (une instance Symfony UnicodeString) qui expose des méthodes pour « manipuler » la chaîne.\nExemple :\n{{ 'cecil_string with twig'|u.camel.title }}\n\nCecilStringWithTwig\n\nsingular\nLe filtre singular transforme un nom donné au pluriel en sa version au singulier.\n{{ string|singular(locale) }}\nExemple :\n{# English (en) rules are used by default #}\n{{ 'partitions'|singular }}\n\npartition\n\n{{ 'partitions'|singular('fr') }}\n\npartition\n\nplural\nLe filtre plural transforme un nom donné au singulier en sa version au pluriel.\n{{ string|plural(locale) }}\nExemple :\n{# English (en) rules are used by default #}\n{{ 'animal'|plural }}\n\nanimals\n\n{{ 'animal'|plural('fr') }}\n\nanimaux\n\nexcerpt\nTronque une chaîne et ajoute un suffixe.\n{{ string|excerpt(length, suffix) }}\n\n\n\nOption\nDescription\nType\nPar défaut\n\n\n\n\nlength\nTronque après ce nombre de caractères.\nentier\n450\n\n\nsuffix\nAjoute des caractères.\nchaîne\n' …' (espace et points de suspension)\n\n\n\nExemples :\n{{ variable|excerpt }}\n{{ variable|excerpt(250, '...') }}\nexcerpt_html\nLit les caractères avant ou après la balise &lt;!-- excerpt --&gt; ou &lt;!-- break --&gt;.\nVoir la documentation du contenu pour plus de détails.\n{{ string|excerpt_html({separator, capture}) }}\n\n\n\nOption\nDescription\nType\nPar défaut\n\n\n\n\nseparator\nChaîne à utiliser comme séparateur.\nchaîne\nexcerpt|break\n\n\ncapture\nPartie à capturer, before ou after le séparateur.\nchaîne\nbefore\n\n\n\nLes valeurs par défaut sont définies par la configuration pages.body.excerpt.\nExemples :\n{{ variable|excerpt_html }}\n{{ variable|excerpt_html({separator: 'excerpt|break', capture: 'before'}) }}\n{{ variable|excerpt_html({capture: 'after'}) }}\nabsolute_urls\nRend absolues les URL relatives à la racine (ex. : \/about\/, \/images\/photo.png) des attributs href, src et srcset d'un contenu HTML, avec le schéma et l'hôte de la baseurl, pour utiliser le contenu en dehors du site (flux, e-mails, etc.).\nLes autres URL (URL absolues ou relatives au protocole, chemins relatifs, ancres, mailto:, data:, etc.) sont conservées telles quelles, et le contenu n'est pas modifié si la baseurl n'est pas absolue.\n{{ string|absolute_urls }}\nExemple :\n{# avec `baseurl: https:\/\/example.com\/` #}\n{{ '&lt;a href=\"\/about\/\"&gt;À propos&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;À propos&lt;\/a&gt; &lt;img src=\"https:\/\/example.com\/images\/photo.png\" srcset=\"https:\/\/example.com\/images\/photo-320.png 320w\"&gt; #}\nLes flux intégrés (Atom, RSS et JSON Feed) appliquent ce filtre au contenu de leurs éléments.\nhighlight\nMet en surbrillance une chaîne de code.\n{{ code|highlight(language, engine) }}\nLe moteur de coloration (highlightjs ou tempest) est l’argument optionnel engine ou, par défaut, l’option layouts.highlight.engine (highlightjs par défaut).\nLe filtre n’utilise pas l’option pages.body.highlight.engine, qui ne s’applique qu’au contenu Markdown.\nSi le langage n’est pas pris en charge par le moteur, le code est retourné échappé, sans coloration (et un avertissement est journalisé).\nExemples :\n{{ '&lt;?php echo $highlighted-&gt;value; ?&gt;'|highlight('php') }}\n{{ '&lt;?php echo $highlighted-&gt;value; ?&gt;'|highlight('php', 'tempest') }}\nChaque moteur utilise ses propres classes CSS (hljs-* pour highlightjs, hl-* pour tempest) : la feuille de style doit correspondre au moteur utilisé.\npreg_split\nDivise une chaîne en un tableau à l’aide d’une expression régulière (limit vaut 0, c’est-à-dire sans limite, par défaut).\n{{ string|preg_split(pattern, limit) }}\nExemple :\n{% set headers = page.content|preg_split('\/&lt;br[^&gt;]*&gt;\/') %}\npreg_match_all\nEffectue une correspondance d’expression régulière et renvoie le groupe pour toutes les correspondances (group vaut 0, c’est-à-dire la correspondance complète, par défaut).\n{{ string|preg_match_all(pattern, group) }}\nExemple :\n{% set tags = page.content|preg_match_all('\/&lt;[^&gt;]+&gt;(.*)&lt;\\\/[^&gt;]+&gt;\/') %}\nhex_to_rgb\nConvertit une couleur hexadécimale en RVB : renvoie un tableau avec les clés red, green et blue.\n{{ color|hex_to_rgb }}\nExemple :\n{% set rgb = '#f00'|hex_to_rgb %}\nrgb({{ rgb.red }}, {{ rgb.green }}, {{ rgb.blue }})\n\nrgb(255, 0, 0)\n\nsplitline\nDivise une chaîne en un tableau de lignes de max caractères maximum (18 par défaut), sans couper les mots.\n{{ string|splitline(max) }}\nExemple :\n{% for line in 'The quick brown fox jumps'|splitline(10) %}\n  {{ line }}&lt;br&gt;\n{% endfor %}\n\nThe quickbrown foxjumps\n\niterable\nConvertit une variable en itérable (tableau) : un tableau est renvoyé tel quel, un objet itérable est converti en tableau, et toute autre valeur est placée dans un tableau.\n{{ variable|iterable }}\nExemple :\n{% for author in page.authors|iterable %}\n  {{ author }}\n{% endfor %}\nunique\nSupprime les valeurs en double d’un tableau de chaînes (sans tenir compte de la casse : la première occurrence est conservée).\n{{ array|unique }}\nExemple :\n{{ ['PHP', 'php', 'Twig']|unique|join(', ') }}\n\nPHP, Twig\n\nduration_to_iso8601\nConvertit une durée en secondes en durée ISO 8601 (ex. : pour la duration d’une vidéo dans les données structurées).\n{{ seconds|duration_to_iso8601 }}\nExemple :\n{{ 125|duration_to_iso8601 }}\n\nPT00H00M125S\n",
      "content_html": "<h1>Filtres</h1>\n<p>Les variables peuvent être modifiées par des <a href=\"https://twig.symfony.com/doc/filters/index.html\" target=\"_blank\" rel=\"noopener noreferrer\">filtres</a>. Les filtres sont séparés de la variable par un symbole de barre verticale (<code translate=\"no\">|</code>). Plusieurs filtres peuvent être chaînés. La sortie d’un filtre est appliquée au suivant.</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>Voir aussi : les filtres dédiés aux 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.) sont documentés dans la section <a href=\"../../assets/index.fr.md\">Assets</a>.</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>Filtre une collection de pages par nom/valeur de variable.</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>Seules les pages standards (de type <code translate=\"no\">page</code>, hors redirections) sont renvoyées.</p>\n<p><em>Exemple :</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>Pour les cas plus complexes, il est préférable d’utiliser le filtre natif <a href=\"https://twig.symfony.com/doc/filters/filter.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code translate=\"no\">filter</code></a> de Twig.</p>\n<p><em>Exemple :</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>Convertit une chaîne Markdown en 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>Exemples :</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>Extrait uniquement les titres correspondant aux <code translate=\"no\">selectors</code> donnés (h2, h3, etc.), ou à ceux définis dans la configuration <code translate=\"no\">pages.body.toc</code> s’ils ne sont pas spécifiés.\nLe paramètre <code translate=\"no\">format</code> définit le format de sortie : <code translate=\"no\">html</code> (par défaut) ou <code translate=\"no\">json</code>.\nLe paramètre <code translate=\"no\">url</code> est utilisé pour créer les liens vers les titres.</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>Exemples :</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>Convertit une chaîne JSON en tableau.</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>Exemple :</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>Convertit une chaîne YAML en tableau.</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>Exemple :</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>Convertit une chaîne en 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>Le filtre <code translate=\"no\">u</code> enveloppe un texte dans un objet Unicode (une <a href=\"https://symfony.com/doc/current/components/string.html\" target=\"_blank\" rel=\"noopener noreferrer\">instance Symfony UnicodeString</a>) qui expose des méthodes pour « manipuler » la chaîne.</p>\n<p><em>Exemple :</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>Le filtre <code translate=\"no\">singular</code> transforme un nom donné au pluriel en sa version au singulier.</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>Exemple :</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>Le filtre <code translate=\"no\">plural</code> transforme un nom donné au singulier en sa version au pluriel.</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>Exemple :</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>Tronque une chaîne et ajoute un suffixe.</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>Par défaut</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>length</td>\n<td>Tronque après ce nombre de caractères.</td>\n<td>entier</td>\n<td>450</td>\n</tr>\n<tr>\n<td>suffix</td>\n<td>Ajoute des caractères.</td>\n<td>chaîne</td>\n<td><code translate=\"no\">' …'</code> (espace et points de suspension)</td>\n</tr>\n</tbody>\n</table>\n<p><em>Exemples :</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>Lit les caractères avant ou après la balise <code translate=\"no\">&lt;!-- excerpt --&gt;</code> ou <code translate=\"no\">&lt;!-- break --&gt;</code>.\nVoir la <a href=\"../../content/3-markdown.fr.md#extrait\">documentation du contenu</a> pour plus de détails.</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>Par défaut</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>separator</td>\n<td>Chaîne à utiliser comme séparateur.</td>\n<td>chaîne</td>\n<td><code translate=\"no\">excerpt|break</code></td>\n</tr>\n<tr>\n<td>capture</td>\n<td>Partie à capturer, <code translate=\"no\">before</code> ou <code translate=\"no\">after</code> le séparateur.</td>\n<td>chaîne</td>\n<td><code translate=\"no\">before</code></td>\n</tr>\n</tbody>\n</table>\n<p>Les valeurs par défaut sont définies par la configuration <code translate=\"no\">pages.body.excerpt</code>.</p>\n<p><em>Exemples :</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>Rend absolues les URL relatives à la racine (ex. : <code translate=\"no\">/about/</code>, <code translate=\"no\">/images/photo.png</code>) des attributs <code translate=\"no\">href</code>, <code translate=\"no\">src</code> et <code translate=\"no\">srcset</code> d'un contenu HTML, avec le schéma et l'hôte de la <code translate=\"no\">baseurl</code>, pour utiliser le contenu en dehors du site (flux, e-mails, etc.).</p>\n<p>Les autres URL (URL absolues ou relatives au protocole, chemins relatifs, ancres, <code translate=\"no\">mailto:</code>, <code translate=\"no\">data:</code>, etc.) sont conservées telles quelles, et le contenu n'est pas modifié si la <code translate=\"no\">baseurl</code> n'est pas absolue.</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>Exemple :</em></p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-comment\">{# avec `baseurl: https://example.com/` #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ '&lt;a href=\"/about/\"&gt;À propos&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;À propos&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>Les flux intégrés (Atom, RSS et JSON Feed) appliquent ce filtre au contenu de leurs éléments.</p></aside>\n<h2 id=\"highlight\">highlight<a class=\"heading-anchor\" href=\"#highlight\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Met en surbrillance une chaîne de code.</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>Le moteur de coloration (<code translate=\"no\">highlightjs</code> ou <code translate=\"no\">tempest</code>) est l’argument optionnel <code translate=\"no\">engine</code> ou, par défaut, l’option <a href=\"../../configuration/7-layouts.fr.md#layouts-highlight\"><code translate=\"no\">layouts.highlight.engine</code></a> (<code translate=\"no\">highlightjs</code> par défaut).</p>\n<aside class=\"note note-tip\"><p>Le filtre n’utilise pas l’option <a href=\"../../configuration/4-pages.fr.md#pages-body-highlight\"><code translate=\"no\">pages.body.highlight.engine</code></a>, qui ne s’applique qu’au contenu Markdown.</p></aside>\n<p>Si le langage n’est pas pris en charge par le moteur, le code est retourné échappé, sans coloration (et un avertissement est journalisé).</p>\n<p><em>Exemples :</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>Chaque moteur utilise ses propres classes CSS (<code translate=\"no\">hljs-*</code> pour <code translate=\"no\">highlightjs</code>, <code translate=\"no\">hl-*</code> pour <code translate=\"no\">tempest</code>) : la feuille de style doit correspondre au moteur utilisé.</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>Divise une chaîne en un tableau à l’aide d’une expression régulière (<code translate=\"no\">limit</code> vaut <code translate=\"no\">0</code>, c’est-à-dire sans limite, par défaut).</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>Exemple :</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>Effectue une correspondance d’expression régulière et renvoie le groupe pour toutes les correspondances (<code translate=\"no\">group</code> vaut <code translate=\"no\">0</code>, c’est-à-dire la correspondance complète, par défaut).</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>Exemple :</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>Convertit une couleur hexadécimale en RVB : renvoie un tableau avec les clés <code translate=\"no\">red</code>, <code translate=\"no\">green</code> et <code translate=\"no\">blue</code>.</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>Exemple :</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>Divise une chaîne en un tableau de lignes de <code translate=\"no\">max</code> caractères maximum (<code translate=\"no\">18</code> par défaut), sans couper les mots.</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>Exemple :</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>Convertit une variable en itérable (tableau) : un tableau est renvoyé tel quel, un objet itérable est converti en tableau, et toute autre valeur est placée dans un tableau.</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>Exemple :</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>Supprime les valeurs en double d’un tableau de chaînes (sans tenir compte de la casse : la première occurrence est conservée).</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>Exemple :</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>Convertit une durée en secondes en <a href=\"https://fr.wikipedia.org/wiki/ISO_8601#Durée\" target=\"_blank\" rel=\"noopener noreferrer\">durée ISO 8601</a> (ex. : pour la <code translate=\"no\">duration</code> d’une vidéo dans les données structurées).</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>Exemple :</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": "fr"
    },
    {
      "id": "https://cloudflare.cecil.app/fr/documentation/templates/composants/",
      "url": "https://cloudflare.cecil.app/fr/documentation/templates/composants/",
      "title": "Composants",
      "summary": "Créez des composants de template réutilisables.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Composants\nCecil fournit des composants pour vous aider à créer des « unités » de templates réutilisables.\nLa fonctionnalité des composants est fournie par l’extension de composants Twig créée par Giorgio Pogliani.\nSyntaxe des composants\nLes composants sont des templates Twig stockés dans le sous-répertoire components\/ de layouts\/ (ex. : layouts\/components\/button.twig), et peuvent être utilisés n’importe où dans vos templates :\n{# layouts\/components\/button.twig #}\n&lt;button {{ attributes.merge({class: 'rounded px-4'}) }}&gt;\n    {{ slot }}\n&lt;\/button&gt;\n\nLa variable slot contient tout contenu ajouté entre la balise d’ouverture et la balise de fermeture.\n\nPour utiliser un composant, utilisez la balise dédiée x suivie de : et du nom de fichier du composant sans extension :\n{# layouts\/index.html.twig #}\n{% x:button with {class: 'text-white'} %}\n    &lt;strong&gt;Click me&lt;\/strong&gt;\n{% endx %}\nCe qui produit :\n&lt;button class=\"text-white rounded px-4\"&gt;\n    &lt;strong&gt;Click me&lt;\/strong&gt;\n&lt;\/button&gt;\nSyntaxe HTML\nLe même composant peut être utilisé avec une syntaxe de type HTML :\n&lt;x-button class=\"text-white\"&gt;\n    &lt;strong&gt;Click me&lt;\/strong&gt;\n&lt;\/x-button&gt;\nPour évaluer la valeur d’un attribut comme une expression Twig, préfixez son nom par : (ex. : &lt;x-button :label=\"page.title\"&gt;).\nSous-dossiers\nLes composants stockés dans des sous-dossiers sont appelés avec la notation pointée :\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;\nSlots nommés\nUn composant peut exposer plusieurs slots nommés :\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\nLe répertoire et l’extension des fichiers de composants peuvent être modifiés avec les options layouts.components (dir, components par défaut, et ext, twig par défaut).",
      "content_html": "<h1>Composants</h1>\n<p>Cecil fournit des composants pour vous aider à créer des « unités » de templates réutilisables.</p>\n<aside class=\"note note-info\"><p>La fonctionnalité des composants est fournie par l’<a href=\"https://github.com/giorgiopogliani/twig-components\" target=\"_blank\" rel=\"noopener noreferrer\"><em>extension de composants Twig</em></a> créée par Giorgio Pogliani.</p></aside>\n<h2 id=\"syntaxe-des-composants\">Syntaxe des composants<a class=\"heading-anchor\" href=\"#syntaxe-des-composants\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Les composants sont des templates Twig stockés dans le sous-répertoire <code translate=\"no\">components/</code> de <code translate=\"no\">layouts/</code> (ex. : <code translate=\"no\">layouts/components/button.twig</code>), et peuvent être utilisés n’importe où dans vos 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>La variable <code translate=\"no\">slot</code> contient tout contenu ajouté entre la balise d’ouverture et la balise de fermeture.</p>\n</blockquote>\n<p>Pour utiliser un composant, utilisez la balise dédiée <code translate=\"no\">x</code> suivie de <code translate=\"no\">:</code> et du nom de fichier du composant sans 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>Ce qui produit :</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=\"syntaxe-html\">Syntaxe HTML<a class=\"heading-anchor\" href=\"#syntaxe-html\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Le même composant peut être utilisé avec une syntaxe de type HTML :</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>Pour évaluer la valeur d’un attribut comme une expression Twig, préfixez son nom par <code translate=\"no\">:</code> (ex. : <code translate=\"no\">&lt;x-button :label=\"page.title\"&gt;</code>).</p>\n<h3 id=\"sous-dossiers\">Sous-dossiers<a class=\"heading-anchor\" href=\"#sous-dossiers\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Les composants stockés dans des sous-dossiers sont appelés avec la <em>notation pointée</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=\"slots-nommes\">Slots nommés<a class=\"heading-anchor\" href=\"#slots-nommes\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Un composant peut exposer plusieurs slots nommés :</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>Le répertoire et l’extension des fichiers de composants peuvent être modifiés avec les options <a href=\"../configuration/7-layouts.fr.md#layouts-components\"><code translate=\"no\">layouts.components</code></a> (<code translate=\"no\">dir</code>, <code translate=\"no\">components</code> par défaut, et <code translate=\"no\">ext</code>, <code translate=\"no\">twig</code> par défaut).</p>",
      "language": "fr"
    },
    {
      "id": "https://cloudflare.cecil.app/fr/documentation/templates/localisation/",
      "url": "https://cloudflare.cecil.app/fr/documentation/templates/localisation/",
      "title": "Localisation",
      "summary": "Traduisez les textes et localisez les dates dans les templates.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-12-04T00:00:00+00:00","content_text": "Localisation\nCecil prend en charge la traduction de texte et la localisation des dates.\nTraduction de texte\nUtilisez la balise ou le filtre trans pour traduire des textes dans les templates.\n{% trans with variables into locale %}{% endtrans %}\n{{ message|trans(variables = []) }}\nExemples\n{% trans %}Hello World!{% endtrans %}\n{{ message|trans }}\nInclure des variables :\n{% trans with {'%name%': 'Arnaud'} %}Hello %name%!{% endtrans %}\n{{ message|trans({'%name%': 'Arnaud'}) }}\nForcer la locale :\n{% trans into 'fr_FR' %}Hello World!{% endtrans %}\nPluraliser :\n{% trans with {'%count%': 42} %}{0}I don't have apples|{1}I have one apple|]1,Inf[I have %count% apples{% endtrans %}\nFichiers de traduction\nLes fichiers de traduction doivent être nommés messages.&lt;locale&gt;.&lt;extension&gt; et stockés dans le répertoire translations.\nLes extensions prises en charge sont définies pour chaque format de traduction dans layouts.translations.formats.\nLe code de locale (ex. : fr_FR) d’une langue est défini dans les entrées languages de la configuration. Un fichier nommé avec le seul code de langue (ex. : messages.fr.yaml) est également chargé, et les traductions des thèmes sont fusionnées avec celles du site.\nExemple :\n&lt;mon-site&gt;\n└─ translations\n   ├─ messages.fr_FR.mo   &lt;- Machine Object format\n   └─ messages.fr_FR.yaml &lt;- YAML format\nVous pouvez facilement extraire les traductions de vos templates avec la commande suivante :\nphp cecil.phar util:translations:extract --locale=&lt;code&gt; --show\nUtilisez --save à la place (ou en plus) de --show pour enregistrer les traductions dans un fichier. L’option --locale est obligatoire. Le format de sortie par défaut est yaml, enregistré dans des fichiers .yml (utilisez --extension=yaml pour des fichiers .yaml, ou --format=po pour le format gettext PO).\nLes labels et descriptions des schémas du front matter sont aussi extraits, dans le fichier schemas (ex. schemas.fr.yml).\nPoedit est un éditeur de traduction simple et multiplateforme pour gettext (PO), et Poedit Pro prend en charge nativement l’extraction des chaînes de traduction depuis les templates.\nLes traductions sont mises en cache : le cache est rafraîchi lorsqu’un fichier de traduction est modifié ou supprimé, mais pas lorsqu’un nouveau fichier est ajouté.\nLe cache peut être vidé avec la commande suivante :\nphp cecil.phar cache:clear:translations\nLocalisation de la date\nUtilisez le filtre Twig format_date pour localiser une date dans les templates.\n{{ page.date|format_date('long') }}\n{# September 30, 2022 #}\nLes valeurs prises en charge sont : none, short, medium, long et full.\nLes filtres format_datetime et format_time sont également disponibles.\nSi vous souhaitez utiliser ces filtres avec d’autres locales que « en », vous devez installer l’extension PHP intl.",
      "content_html": "<h1>Localisation</h1>\n<p>Cecil prend en charge la <a href=\"#traduction-de-texte\">traduction de texte</a> et la <a href=\"#localisation-de-la-date\">localisation des dates</a>.</p>\n<h2 id=\"traduction-de-texte\">Traduction de texte<a class=\"heading-anchor\" href=\"#traduction-de-texte\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Utilisez la <em>balise</em> ou le <em>filtre</em> <code translate=\"no\">trans</code> pour traduire des textes dans les 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=\"exemples\">Exemples<a class=\"heading-anchor\" href=\"#exemples\" 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>Inclure des 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>Forcer la 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>Pluraliser :</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=\"fichiers-de-traduction\">Fichiers de traduction<a class=\"heading-anchor\" href=\"#fichiers-de-traduction\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Les fichiers de traduction doivent être nommés <code translate=\"no\">messages.&lt;locale&gt;.&lt;extension&gt;</code> et stockés dans le répertoire <a href=\"../configuration/7-layouts.fr.md#layouts-translations\"><code translate=\"no\">translations</code></a>.\nLes extensions prises en charge sont définies pour chaque format de traduction dans <a href=\"../configuration/7-layouts.fr.md#layouts-translations\"><code translate=\"no\">layouts.translations.formats</code></a>.</p>\n<p>Le code de locale (ex. : <code translate=\"no\">fr_FR</code>) d’une langue est défini dans les entrées <a href=\"../configuration/2-languages.fr.md#languages\"><code translate=\"no\">languages</code></a> de la configuration. Un fichier nommé avec le seul code de langue (ex. : <code translate=\"no\">messages.fr.yaml</code>) est également chargé, et les traductions des <a href=\"7-extend.fr.md#theme\">thèmes</a> sont fusionnées avec celles du site.</p>\n<p><em>Exemple :</em></p>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">&lt;mon-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>Vous pouvez facilement extraire les traductions de vos templates avec la commande suivante :</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>Utilisez <code translate=\"no\">--save</code> à la place (ou en plus) de <code translate=\"no\">--show</code> pour enregistrer les traductions dans un fichier. L’option <code translate=\"no\">--locale</code> est obligatoire. Le format de sortie par défaut est <code translate=\"no\">yaml</code>, enregistré dans des fichiers <code translate=\"no\">.yml</code> (utilisez <code translate=\"no\">--extension=yaml</code> pour des fichiers <code translate=\"no\">.yaml</code>, ou <code translate=\"no\">--format=po</code> pour le format gettext PO).</p>\n<p>Les labels et descriptions des <a href=\"../configuration/4-pages.fr.md#traduction-des-descriptions\">schémas du front matter</a> sont aussi extraits, dans le fichier <code translate=\"no\">schemas</code> (ex. <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> est un éditeur de traduction simple et multiplateforme pour gettext (PO), et <a href=\"https://poedit.net/pro\" target=\"_blank\" rel=\"noopener noreferrer\"><em>Poedit Pro</em></a> prend en charge nativement l’extraction des chaînes de traduction depuis les templates.</p></aside>\n<aside class=\"note note-important\"><p>Les traductions sont mises en <a href=\"6-cache.fr.md\">cache</a> : le cache est rafraîchi lorsqu’un fichier de traduction est modifié ou supprimé, mais pas lorsqu’un nouveau fichier est ajouté.</p>\n<p>Le cache peut être vidé avec la commande suivante :</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=\"localisation-de-la-date\">Localisation de la date<a class=\"heading-anchor\" href=\"#localisation-de-la-date\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Utilisez le filtre 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> pour localiser une date dans les 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>Les valeurs prises en charge sont : <code translate=\"no\">none</code>, <code translate=\"no\">short</code>, <code translate=\"no\">medium</code>, <code translate=\"no\">long</code> et <code translate=\"no\">full</code>.</p>\n<p>Les filtres <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> et <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> sont également disponibles.</p>\n<aside class=\"note note-important\"><p>Si vous souhaitez utiliser ces filtres <strong>avec d’autres locales que « en »</strong>, vous devez <a href=\"https://php.net/intl.setup\" target=\"_blank\" rel=\"noopener noreferrer\">installer l’extension PHP intl</a>.</p></aside>",
      "language": "fr"
    },
    {
      "id": "https://cloudflare.cecil.app/fr/documentation/templates/cache/",
      "url": "https://cloudflare.cecil.app/fr/documentation/templates/cache/",
      "title": "Cache",
      "summary": "Cache des templates et cache de fragments.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Cache\nCecil utilise un système de cache pour accélérer le processus de génération ; il peut être désactivé ou vidé.\nIl existe trois types de cache impliqués dans le rendu des templates : les templates, les assets et les traductions.\nVider le cache\nVous pouvez vider le cache avec les commandes suivantes :\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\nEn pratique, vous n’avez pas besoin de vider le cache manuellement : Cecil le fait pour vous en cas de besoin (par exemple lorsque des fichiers changent).\nCache de fragments\nCecil fournit un moyen de mettre en cache des parties du rendu des templates pour éviter de générer plusieurs fois le même contenu partiel.\nPour utiliser le cache de fragments, enveloppez le contenu que vous souhaitez mettre en cache avec la balise cache.\n{% cache 'unique-key' %}\n  {# cacheable content #}\n{% endcache %}\nIl est recommandé d’utiliser la fonction cache_key pour être sûr d’avoir une clé de cache unique pour chaque contenu que vous souhaitez mettre en cache.\nLe cache de fragments est persistant : si la clé de cache est trop générique, vous risquez d’afficher un contenu erroné.\nPour vider uniquement le cache de fragments, utilisez la commande suivante :\nphp cecil.phar cache:clear:templates --fragments\nDésactiver le cache\nVous pouvez désactiver le cache avec la configuration.\nLa désactivation du cache peut ralentir le processus de génération, ce n’est donc pas recommandé.\nLors du développement local, si vous devez vider le cache avant chaque génération, vous pouvez utiliser l’option suivante :\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;\nExemple :\nphp cecil.phar serve --clear-cache=css  # clear cache for all CSS files",
      "content_html": "<h1>Cache</h1>\n<p>Cecil utilise un système de cache pour accélérer le processus de génération ; il peut être désactivé ou vidé.</p>\n<p>Il existe trois types de cache impliqués dans le rendu des templates : les templates, les <a href=\"../assets/index.fr.md#asset\">assets</a> et les <a href=\"5-localization.fr.md#fichiers-de-traduction\">traductions</a>.</p>\n<h2 id=\"vider-le-cache\">Vider le cache<a class=\"heading-anchor\" href=\"#vider-le-cache\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Vous pouvez vider le cache avec les commandes suivantes :</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>En pratique, vous n’avez pas besoin de vider le cache manuellement : Cecil le fait pour vous en cas de besoin (par exemple lorsque des fichiers changent).</p></aside>\n<h2 id=\"cache-de-fragments\">Cache de fragments<a class=\"heading-anchor\" href=\"#cache-de-fragments\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Cecil fournit un moyen de mettre en cache des parties du rendu des templates pour éviter de générer plusieurs fois le même contenu partiel.</p>\n<p>Pour utiliser le cache de <em>fragments</em>, enveloppez le contenu que vous souhaitez mettre en cache avec la balise <a href=\"https://twig.symfony.com/doc/tags/cache.html\" target=\"_blank\" rel=\"noopener noreferrer\"><code translate=\"no\">cache</code></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>Il est recommandé d’utiliser la fonction <a href=\"reference/1-functions.fr.md#cache-key\"><code translate=\"no\">cache_key</code></a> pour être sûr d’avoir une clé de cache unique pour chaque contenu que vous souhaitez mettre en cache.</p></aside>\n<aside class=\"note note-warning\"><p>Le cache de <em>fragments</em> est persistant : si la clé de cache est trop générique, vous risquez d’afficher un contenu erroné.</p></aside>\n<p>Pour vider uniquement le cache de fragments, utilisez la commande suivante :</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=\"desactiver-le-cache\">Désactiver le cache<a class=\"heading-anchor\" href=\"#desactiver-le-cache\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Vous pouvez désactiver le cache avec la <a href=\"../configuration/9-cache.fr.md\">configuration</a>.</p>\n<aside class=\"note note-warning\"><p>La désactivation du cache peut ralentir le processus de génération, ce n’est donc pas recommandé.</p>\n<p>Lors du développement local, si vous devez vider le cache avant chaque génération, vous pouvez utiliser l’option suivante :</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>Exemple :</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": "fr"
    },
    {
      "id": "https://cloudflare.cecil.app/fr/documentation/templates/etendre/",
      "url": "https://cloudflare.cecil.app/fr/documentation/templates/etendre/",
      "title": "Étendre les templates",
      "summary": "Ajoutez des fonctions et filtres personnalisés, ou utilisez un thème.",
      "date_published": "2026-05-26T00:00:00+00:00",
      "date_modified": "2026-11-15T00:00:00+00:00","content_text": "Étendre les templates\nLes templates peuvent être étendus avec des fonctions et filtres personnalisés, ou regroupés dans un thème réutilisable.\nFonctions et filtres\nVous pouvez ajouter des fonctions et des filtres personnalisés avec une extension Twig.\nThème\nIl est simple de créer un thème : il suffit de créer un dossier &lt;theme&gt; avec la structure suivante (comme un site web, mais sans pages) :\n&lt;mon-site&gt;\n└─ themes\n   └─ &lt;theme&gt;\n      ├─ config.yml\n      ├─ assets\n      ├─ layouts\n      ├─ schemas\n      ├─ static\n      └─ translations\nActivez-le ensuite avec l’option de configuration theme.\nLe fichier config.yml du thème surcharge la configuration par défaut et est fusionné avec la configuration du site, qui est prioritaire, sauf pour les listes de valeurs : les valeurs du site s’ajoutent à celles du thème, et une valeur du thème ne peut être retirée qu’avec false (ex. homepage: {atom: false}).\nLe dossier schemas du thème contient les schémas du front matter des variables attendues par ses templates : les schémas du site les surchargent variable par variable.\nThèmes requis\nUn thème peut requérir d’autres thèmes (ex. un thème composant fournissant un champ de recherche, ou un plugin) avec l’option theme de son config.yml :\n\/themes\/&lt;theme&gt;\/config.yml\ntheme:\n  - &lt;theme-requis&gt;\nLes thèmes requis sont activés avec le thème, sans autre configuration du site : leurs layouts, assets, fichiers statiques, traductions, extensions et config.yml sont chargés. Ils sont ajoutés après les thèmes du site : le thème (comme le site) surcharge donc les thèmes qu’il requiert.\nLes thèmes requis doivent eux aussi être installés, dans le dossier themes du site : déclarez-les comme dépendances dans le composer.json du thème.",
      "content_html": "<h1>Étendre les templates</h1>\n<p>Les templates peuvent être étendus avec des fonctions et filtres personnalisés, ou regroupés dans un thème réutilisable.</p>\n<h2 id=\"fonctions-et-filtres\">Fonctions et filtres<a class=\"heading-anchor\" href=\"#fonctions-et-filtres\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Vous pouvez ajouter des <a href=\"reference/1-functions.fr.md\">fonctions</a> et des <a href=\"reference/3-filters.fr.md\">filtres</a> personnalisés avec une <a href=\"../developers/1-extend.fr.md#extension-twig\"><strong><em>extension Twig</em></strong></a>.</p>\n<h2 id=\"theme\">Thème<a class=\"heading-anchor\" href=\"#theme\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Il est simple de créer un thème : il suffit de créer un dossier <code translate=\"no\">&lt;theme&gt;</code> avec la structure suivante (comme un site web, mais sans pages) :</p>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">&lt;mon-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>Activez-le ensuite avec l’option de configuration <a href=\"../configuration/1-site.fr.md#theme\"><code translate=\"no\">theme</code></a>.</p>\n<p>Le fichier <code translate=\"no\">config.yml</code> du thème surcharge la <a href=\"../configuration/index.fr.md#priorite\">configuration par défaut</a> et est fusionné avec la configuration du site, qui est prioritaire, sauf pour les <a href=\"../configuration/index.fr.md#listes\">listes de valeurs</a> : les valeurs du site s’ajoutent à celles du thème, et une valeur du thème ne peut être retirée qu’avec <code translate=\"no\">false</code> (ex. <code translate=\"no\">homepage: {atom: false}</code>).</p>\n<p>Le dossier <code translate=\"no\">schemas</code> du thème contient les <a href=\"../configuration/4-pages.fr.md#repertoire-des-schemas\">schémas du front matter</a> des variables attendues par ses templates : les schémas du site les surchargent variable par variable.</p>\n<h3 id=\"themes-requis\">Thèmes requis<a class=\"heading-anchor\" href=\"#themes-requis\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Un thème peut requérir d’autres thèmes (ex. un thème composant fournissant un champ de recherche, ou un <a href=\"../developers/1-extend.fr.md#plugins\">plugin</a>) avec l’option <code translate=\"no\">theme</code> de son <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;theme-requis&gt;</span></code></pre>\n<p>Les thèmes requis sont activés avec le thème, sans autre configuration du site : leurs layouts, assets, fichiers statiques, traductions, extensions et <code translate=\"no\">config.yml</code> sont chargés. Ils sont ajoutés après les thèmes du site : le thème (comme le site) surcharge donc les thèmes qu’il requiert.</p>\n<aside class=\"note note-important\"><p>Les thèmes requis doivent eux aussi être installés, dans le dossier <code translate=\"no\">themes</code> du site : déclarez-les comme dépendances dans le <code translate=\"no\">composer.json</code> du thème.</p></aside>",
      "language": "fr"
    }
  ]
}
