<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="https://cecil.app/fr/xsl/atom.xsl" media="all"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
  <id>https://cecil.app/fr/comment-faire/</id>
  <title>Cecil - Comment faire ?</title>
  <subtitle><![CDATA[Cecil est une application PHP en ligne de commande qui fusionne des pages Markdown, des médias et des templates Twig afin de générer un site Web statique.]]></subtitle>
  <link href="https://cecil.app/fr/comment-faire/atom.xml" rel="self" type="application/atom+xml" />
  <link href="https://cecil.app/fr/comment-faire/" rel="alternate" type="text/html" />
  <updated>2026-10-07T21:40:49+00:00</updated>
  <author>
    <name>Cecil</name>
    <uri>https://cecil.app</uri>
  </author>
  <entry xml:lang="fr">
    <id>https://cecil.app/fr/comment-faire/deploiement-github-pages/</id>
    <title>Déployer sur GitHub Pages avec GitHub Actions</title>
    <published>2026-10-07T00:00:00+00:00</published>
    <link href="https://cecil.app/fr/comment-faire/deploiement-github-pages/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Avec la <a href="https://github.com/Cecilapp/Cecil-Action" target="_blank" rel="noopener noreferrer">Cecil Action</a>, chaque push sur votre dépôt génère le site et le publie sur <strong>GitHub Pages</strong>, sans serveur à gérer.</p>
<h2 id="activer-github-pages">Activer GitHub Pages</h2>
<p>Dans votre dépôt, allez dans <strong>Settings</strong> → <strong>Pages</strong> puis, dans <strong>Build and deployment</strong>, choisissez <strong>GitHub Actions</strong> comme <strong>Source</strong>.</p>
<h2 id="ajouter-le-workflow">Ajouter le workflow</h2>
<p>Créez le fichier <code translate="no">.github/workflows/build-and-deploy.yml</code> :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">name:</span> <span class="hljs-string">Build</span> <span class="hljs-string">and</span> <span class="hljs-string">deploy</span> <span class="hljs-string">to</span> <span class="hljs-string">GitHub</span> <span class="hljs-string">Pages</span>
<span class="hljs-attr">on:</span>
  <span class="hljs-attr">push:</span>
    <span class="hljs-attr">branches:</span> <span class="hljs-string">[master,</span> <span class="hljs-string">main]</span>
  <span class="hljs-attr">workflow_dispatch:</span>
<span class="hljs-attr">concurrency:</span>
  <span class="hljs-attr">group:</span> <span class="hljs-string">pages</span>
  <span class="hljs-attr">cancel-in-progress:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">jobs:</span>
  <span class="hljs-attr">build:</span>
    <span class="hljs-attr">runs-on:</span> <span class="hljs-string">ubuntu-latest</span>
    <span class="hljs-attr">steps:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Checkout</span> <span class="hljs-string">source</span>
        <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/checkout@v6</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Build</span> <span class="hljs-string">site</span>
        <span class="hljs-attr">uses:</span> <span class="hljs-string">Cecilapp/Cecil-Action@v4</span>
  <span class="hljs-attr">deploy:</span>
    <span class="hljs-attr">needs:</span> <span class="hljs-string">build</span>
    <span class="hljs-attr">permissions:</span>
      <span class="hljs-attr">pages:</span> <span class="hljs-string">write</span>
      <span class="hljs-attr">id-token:</span> <span class="hljs-string">write</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-attr">name:</span> <span class="hljs-string">github-pages</span>
      <span class="hljs-attr">url:</span> <span class="hljs-string">${{</span> <span class="hljs-string">steps.deployment.outputs.page_url</span> <span class="hljs-string">}}</span>
    <span class="hljs-attr">runs-on:</span> <span class="hljs-string">ubuntu-latest</span>
    <span class="hljs-attr">steps:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Deploy</span> <span class="hljs-string">to</span> <span class="hljs-string">GitHub</span> <span class="hljs-string">Pages</span>
        <span class="hljs-attr">id:</span> <span class="hljs-string">deployment</span>
        <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/deploy-pages@v5</span></code></pre>
<p>Le job <code translate="no">build</code> télécharge Cecil, installe les thèmes (si un fichier <code translate="no">composer.json</code> existe), génère le site et envoie le répertoire de sortie en tant qu’artefact Pages. Le job <code translate="no">deploy</code> le publie ensuite.</p>
<h2 id="url-de-base">URL de base</h2>
<p>Inutile de modifier <code translate="no">baseurl</code> dans <code translate="no">cecil.yml</code> : l’action génère le site avec l’URL fournie par GitHub Pages (par exemple <code translate="no">https://&lt;user&gt;.github.io/&lt;repository&gt;/</code>), via l’option <code translate="no">--baseurl</code>.</p>
<h2 id="personnaliser-la-generation">Personnaliser la génération</h2>
<p>L’action accepte les paramètres optionnels suivants :</p>
<pre><code class="language-yaml hljs yaml" translate="no">      <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Build</span> <span class="hljs-string">site</span>
        <span class="hljs-attr">uses:</span> <span class="hljs-string">Cecilapp/Cecil-Action@v4</span>
        <span class="hljs-attr">with:</span>
          <span class="hljs-attr">version:</span> <span class="hljs-string">'9.6.2'</span>       <span class="hljs-comment"># version de Cecil (la dernière par défaut)</span>
          <span class="hljs-attr">install_themes:</span> <span class="hljs-string">'no'</span>   <span class="hljs-comment"># ne pas installer les thèmes (`yes` par défaut)</span>
          <span class="hljs-attr">options:</span> <span class="hljs-string">'-v --drafts'</span> <span class="hljs-comment"># options de la commande build (`-v` par défaut)</span></code></pre>
<aside class="note note-tip"><p>Pour accélérer la génération, vous pouvez aussi restaurer et sauvegarder le répertoire <code translate="no">.cache</code> entre deux exécutions : consultez le workflow complet dans la <a href="/documentation/deploy/#github-pages">documentation du déploiement sur GitHub Pages</a>, ainsi que la liste des <a href="/documentation/commands/#build">options de build</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="fr">
    <id>https://cecil.app/fr/comment-faire/sortie-flux-rss-json/</id>
    <title>Publier un flux RSS ou JSON</title>
    <published>2026-10-06T00:00:00+00:00</published>
    <link href="https://cecil.app/fr/comment-faire/sortie-flux-rss-json/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil génère les flux grâce aux <strong>formats de sortie</strong> : par défaut, la page d’accueil, les sections et les termes de taxonomie sont déjà publiés en HTML <strong>et en Atom</strong> (ex. <code translate="no">/atom.xml</code>, <code translate="no">/blog/atom.xml</code>). Ajoutez les formats <code translate="no">rss</code> ou <code translate="no">jsonfeed</code> pour publier aussi des fichiers RSS 2.0 ou <a href="https://www.jsonfeed.org" target="_blank" rel="noopener noreferrer">JSON Feed</a>.</p>
<h2 id="activer-les-flux-pour-toutes-les-pages-de-liste">Activer les flux pour toutes les pages de liste</h2>
<p>Définissez les formats appliqués à chaque type de page avec <code translate="no">output.pagetypeformats</code> :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">output:</span>
  <span class="hljs-attr">pagetypeformats:</span>
    <span class="hljs-attr">homepage:</span> <span class="hljs-string">[html,</span> <span class="hljs-string">atom,</span> <span class="hljs-string">rss,</span> <span class="hljs-string">jsonfeed]</span>
    <span class="hljs-attr">section:</span> <span class="hljs-string">[html,</span> <span class="hljs-string">atom,</span> <span class="hljs-string">rss,</span> <span class="hljs-string">jsonfeed]</span></code></pre>
<p>Cecil génère alors <code translate="no">rss.xml</code> et <code translate="no">feed.json</code> à côté de chaque <code translate="no">index.html</code> de la page d’accueil et des sections (ex. <code translate="no">/blog/rss.xml</code>, <code translate="no">/blog/feed.json</code>).</p>
<aside class="note note-info"><p>Les formats sont remplacés, pas fusionnés : conservez <code translate="no">html</code> dans la liste. Voir <a href="/documentation/configuration/#output-pagetypeformats"><code translate="no">output.pagetypeformats</code></a> et la liste des <a href="/documentation/configuration/#output-formats">formats par défaut</a>.</p></aside>
<h2 id="activer-un-flux-pour-une-seule-section">Activer un flux pour une seule section</h2>
<p>Pour publier un flux pour une seule section, utilisez la variable <a href="/documentation/content/#output"><code translate="no">output</code></a> dans le front matter de la page d’index de la section :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">Blog</span>
<span class="hljs-attr">output:</span> <span class="hljs-string">[html,</span> <span class="hljs-string">rss]</span>
<span class="hljs-meta">---</span></code></pre>
<h2 id="signaler-le-flux">Signaler le flux</h2>
<p>Si vos templates incluent le <a href="/documentation/configuration/#metatags">partial metatags</a>, les balises <code translate="no">&lt;link rel="alternate"&gt;</code> pointant vers les flux de la page courante sont ajoutées automatiquement dans le <code translate="no">&lt;head&gt;</code>.</p>
<p>Sinon, ajoutez le lien vous-même avec la fonction <code translate="no">url()</code> et son option <code translate="no">format</code> :</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"alternate"</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"application/rss+xml"</span> <span class="hljs-attr">title</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ site.title }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ url(page, {canonical: true, format: 'rss'}) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span></span></code></pre>
<h2 id="personnaliser-le-template-du-flux">Personnaliser le template du flux</h2>
<p>Les flux sont générés par les <a href="/documentation/templates/#built-in-templates">templates intégrés</a> <code translate="no">_default/list.rss.twig</code>, <code translate="no">_default/list.atom.twig</code> et <code translate="no">_default/list.jsonfeed.twig</code>. Selon les <a href="/documentation/templates/#lookup-rules">règles de recherche</a>, créez <code translate="no">layouts/list.rss.twig</code> (toutes les pages de liste) ou <code translate="no">layouts/blog/list.rss.twig</code> (section <code translate="no">blog</code> uniquement) pour les surcharger.</p>
<p>Vous pouvez étendre le template intégré et redéfinir uniquement le bloc <code translate="no">item</code>, par exemple pour publier un extrait plutôt que le contenu complet :</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">extends</span></span> '_default/list.rss.twig' %}</span><span class="xml">

</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">block</span></span> item %}</span><span class="xml">
      <span class="hljs-tag">&lt;<span class="hljs-name">guid</span>&gt;</span></span><span class="hljs-template-variable">{{ url(item, {canonical: true}) }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">guid</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span></span><span class="hljs-template-variable">{{ item.title|e }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">pubDate</span>&gt;</span></span><span class="hljs-template-variable">{{ item.<span class="hljs-name">date</span>|<span class="hljs-keyword">date</span>('r') }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">pubDate</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">link</span>&gt;</span></span><span class="hljs-template-variable">{{ url(item, {canonical: true}) }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">link</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">description</span>&gt;</span>&lt;![CDATA[</span><span class="hljs-template-variable">{{ item.content|excerpt_html }}</span><span class="xml">]]&gt;<span class="hljs-tag">&lt;/<span class="hljs-name">description</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endblock</span></span> %}</span></code></pre>
<aside class="note note-tip"><p>Définissez <a href="/documentation/configuration/#baseurl"><code translate="no">baseurl</code></a> dans <code translate="no">cecil.yml</code> : les flux utilisent des URL absolues.</p>
<p>Le flux RSS peut aussi être mis en forme dans les navigateurs en activant la <a href="/documentation/configuration/#pages-default">page par défaut</a> <code translate="no">xsl/rss</code> :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">default:</span>
    <span class="hljs-attr">xsl/rss:</span>
      <span class="hljs-attr">published:</span> <span class="hljs-literal">true</span></code></pre></aside>]]>
    </content>
  </entry>
  <entry xml:lang="fr">
    <id>https://cecil.app/fr/comment-faire/templates-pagination/</id>
    <title>Paginer une liste de pages</title>
    <published>2026-10-05T00:00:00+00:00</published>
    <link href="https://cecil.app/fr/comment-faire/templates-pagination/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Lorsqu’une section contient de nombreuses pages, Cecil peut découper sa liste en plusieurs pages (ex. : <code translate="no">/blog/</code>, <code translate="no">/blog/page/2/</code>, <code translate="no">/blog/page/3/</code>, etc.) et fournit un <em>paginator</em> pour construire les liens de navigation.</p>
<h2 id="configurer-la-pagination">Configurer la pagination</h2>
<p>La pagination est activée par défaut pour les pages de liste (<em>homepage</em>, <em>section</em> et <em>term</em>), avec 5 entrées par page. Modifiez-la dans <code translate="no">cecil.yml</code> :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">pagination:</span>
    <span class="hljs-attr">max:</span> <span class="hljs-number">10</span>    <span class="hljs-comment"># nombre maximum d’entrées par page</span>
    <span class="hljs-attr">path:</span> <span class="hljs-string">page</span> <span class="hljs-comment"># chemin des pages paginées</span></code></pre>
<h2 id="la-surcharger-pour-une-section">La surcharger pour une section</h2>
<p>Définissez la variable <code translate="no">pagination</code> dans le front matter du fichier index de la section (ex. : <code translate="no">pages/blog/index.md</code>) :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">Blog</span>
<span class="hljs-attr">pagination:</span>
  <span class="hljs-attr">max:</span> <span class="hljs-number">20</span>
<span class="hljs-meta">---</span></code></pre>
<p>Ou désactivez-la pour cette section uniquement :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">pagination:</span> <span class="hljs-literal">false</span>
<span class="hljs-meta">---</span></code></pre>
<h2 id="afficher-les-pages-paginees">Afficher les pages paginées</h2>
<p>Dans le template de liste (ex. : <code translate="no">layouts/blog/list.html.twig</code>), bouclez sur <code translate="no">page.paginator.pages</code> et utilisez <code translate="no">page.pages</code> lorsque la pagination est désactivée :</p>
<pre><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 page.paginator.pages ?? page.pages %}</span><span class="xml">
  <span class="hljs-tag">&lt;<span class="hljs-name">article</span>&gt;</span>
    <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>
    <span class="hljs-tag">&lt;<span class="hljs-name">time</span> <span class="hljs-attr">datetime</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ p.<span class="hljs-name">date</span>|<span class="hljs-keyword">date</span>('c') }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span></span><span class="hljs-template-variable">{{ p.<span class="hljs-name">date</span>|<span class="hljs-keyword">date</span>('j M Y') }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">time</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">article</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endfor</span></span> %}</span></code></pre>
<h2 id="ajouter-les-liens-de-navigation">Ajouter les liens de navigation</h2>
<p>Les liens du paginator sont des identifiants de pages : utilisez la fonction <code translate="no">url()</code> pour créer des liens fonctionnels :</p>
<pre><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">
<span class="hljs-tag">&lt;<span class="hljs-name">nav</span>&gt;</span>
  </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">
  <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> <span class="hljs-attr">rel</span>=<span class="hljs-string">"prev"</span>&gt;</span>Previous<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</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">&lt;<span class="hljs-name">span</span>&gt;</span>Page </span><span class="hljs-template-variable">{{ page.paginator.current }}</span><span class="xml"> of </span><span class="hljs-template-variable">{{ page.paginator.count }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
  </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">
  <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> <span class="hljs-attr">rel</span>=<span class="hljs-string">"next"</span>&gt;</span>Next<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</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">&lt;/<span class="hljs-name">nav</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endif</span></span> %}</span></code></pre>
<p>Pour lister tous les numéros de page, itérez de <code translate="no">1</code> à <code translate="no">page.paginator.count</code> :</p>
<pre><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">
<span class="hljs-tag">&lt;<span class="hljs-name">nav</span>&gt;</span>
  </span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">for</span></span> i in 1..page.paginator.count %}</span><span class="xml">
    </span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">if</span></span> i == page.paginator.current %}</span><span class="xml">
  <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">aria-current</span>=<span class="hljs-string">"page"</span>&gt;</span></span><span class="hljs-template-variable">{{ i }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
    </span><span class="hljs-template-tag">{% <span class="hljs-name">elseif</span> i == 1 %}</span><span class="xml">
  <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">{{ i }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
    </span><span class="hljs-template-tag">{% <span class="hljs-name">else</span> %}</span><span class="xml">
  <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 ~ '/' ~ i) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span></span><span class="hljs-template-variable">{{ i }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
    </span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endif</span></span> %}</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">
<span class="hljs-tag">&lt;/<span class="hljs-name">nav</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endif</span></span> %}</span></code></pre>
<aside class="note note-info"><p>Consultez la documentation de la <a href="/documentation/templates/#page">variable <code translate="no">page.paginator</code></a>, de la <a href="/documentation/configuration/#pages-pagination">configuration de la pagination</a> et de la <a href="/documentation/content/#section">variable <code translate="no">pagination</code> des sections</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="fr">
    <id>https://cecil.app/fr/comment-faire/contenu-multilingue/</id>
    <title>Traduire un site en plusieurs langues</title>
    <published>2026-10-04T00:00:00+00:00</published>
    <link href="https://cecil.app/fr/comment-faire/contenu-multilingue/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil gère nativement les sites multilingues : il suffit de déclarer les langues, d’ajouter les pages traduites, puis de les relier entre elles et de traduire les templates.</p>
<h2 id="declarer-les-langues">Déclarer les langues</h2>
<p>Définissez la langue principale et la liste des langues disponibles dans <code translate="no">cecil.yml</code> :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">language:</span> <span class="hljs-string">en</span>
<span class="hljs-attr">languages:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">code:</span> <span class="hljs-string">en</span>
    <span class="hljs-attr">name:</span> <span class="hljs-string">English</span>
    <span class="hljs-attr">locale:</span> <span class="hljs-string">en_US</span>
  <span class="hljs-bullet">-</span> <span class="hljs-attr">code:</span> <span class="hljs-string">fr</span>
    <span class="hljs-attr">name:</span> <span class="hljs-string">Français</span>
    <span class="hljs-attr">locale:</span> <span class="hljs-string">fr_FR</span>
    <span class="hljs-attr">config:</span>
      <span class="hljs-attr">title:</span> <span class="hljs-string">"Mon site en français"</span></code></pre>
<p>Les options placées sous la clé <code translate="no">config</code> d’une langue remplacent les options globales (ici le <code translate="no">title</code> du site).</p>
<h2 id="traduire-une-page">Traduire une page</h2>
<p>Dupliquez la page de référence et suffixez son nom de fichier avec le code de la langue :</p>
<pre><code class="language-plaintext hljs plaintext" translate="no">pages/
├─ about.md    # la page de référence
└─ about.fr.md # la version française</code></pre>
<p>Utilisez la variable <code translate="no">slug</code> pour traduire l’URL de la page :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">À</span> <span class="hljs-string">propos</span>
<span class="hljs-attr">slug:</span> <span class="hljs-string">a-propos</span>
<span class="hljs-meta">---</span></code></pre>
<p><code translate="no">about.md</code> est publiée sur <code translate="no">/about/</code> et <code translate="no">about.fr.md</code> sur <code translate="no">/fr/a-propos/</code>.</p>
<aside class="note note-tip"><p>Pour créer une page qui n’existe que dans une autre langue (sans être une traduction), définissez <code translate="no">language: fr</code> dans son front matter.</p></aside>
<h2 id="relier-les-pages-traduites">Relier les pages traduites</h2>
<p>Chaque page expose ses traductions via <code translate="no">page.translations</code>. Ajoutez un sélecteur de langue à votre template :</p>
<pre><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 page.translations %}</span><span class="xml">
  <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> <span class="hljs-attr">hreflang</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ p.language }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span></span><span class="hljs-template-variable">{{ site.language.name(p.language) }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endfor</span></span> %}</span></code></pre>
<p>Vous pouvez aussi inclure le partial intégré : <code translate="no">{{ include('partials/languages.html.twig') }}</code>.</p>
<h2 id="traduire-les-textes-des-templates">Traduire les textes des templates</h2>
<p>Encadrez les textes avec le tag ou le filtre <code translate="no">trans</code> :</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="hljs-template-tag">{% <span class="hljs-name">trans</span> %}</span><span class="xml">Read more</span><span class="hljs-template-tag">{% <span class="hljs-name">endtrans</span> %}</span><span class="xml">
</span><span class="hljs-template-variable">{{ 'Read more'|trans }}</span></code></pre>
<p>Ajoutez ensuite un fichier de traduction nommé d’après la locale de la langue dans le dossier <code translate="no">translations</code> :</p>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-comment"># translations/messages.fr_FR.yaml</span>
<span class="hljs-attr">Read more:</span> <span class="hljs-string">Lire</span> <span class="hljs-string">la</span> <span class="hljs-string">suite</span></code></pre>
<p>Extrayez les textes de vos templates avec :</p>
<pre><code class="language-bash hljs bash" translate="no">php cecil.phar util:translations:extract --locale=fr_FR --save</code></pre>
<aside class="note note-info"><p>Consultez la documentation du <a href="/documentation/content/#multilingual">contenu multilingue</a>, de la <a href="/documentation/configuration/#languages">configuration des langues</a> et de la <a href="/documentation/templates/#localization">localisation des templates</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="fr">
    <id>https://cecil.app/fr/comment-faire/templates-metatags/</id>
    <title>Appliquer les fonctionnalités SEO dans les templates</title>
    <published>2026-06-09T00:00:00+00:00</published>
    <link href="https://cecil.app/fr/comment-faire/templates-metatags/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil expose sa feature SEO via le template <code translate="no">partials/metatags.html.twig</code>. Il suffit de l’inclure dans le <code translate="no">&lt;head&gt;</code> du template de base pour que chaque page bénéficie automatiquement <strong>des balises meta, des liens canoniques, des cartes sociales et des données structurées</strong>.</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ site.language }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"utf-8"</span>&gt;</span>
    </span><span class="hljs-template-variable">{{ <span class="hljs-name">include</span><span class="hljs-params">('partials/metatags.html.twig')</span> }}</span><span class="xml">
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    ...
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span></span></code></pre>
<p>Le partial lit d’abord le front matter de la page, puis reprend les options du site si nécessaire. Consultez la <a href="/documentation/configuration/#metatags">documentation de configuration des metatags</a> pour voir toutes les options disponibles.</p>
<p>Si vous devez surcharger le titre ou l’image, passez des valeurs directement au partial :</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ <span class="hljs-name">include</span><span class="hljs-params">('partials/metatags.html.twig', {title: 'Custom title', image: og_image})</span> }}</span></code></pre>]]>
    </content>
  </entry>
  <entry xml:lang="fr">
    <id>https://cecil.app/fr/comment-faire/markdown-performance-images/</id>
    <title>Optimiser les images dans Markdown</title>
    <published>2025-07-25T00:00:00+00:00</published>
    <link href="https://cecil.app/fr/comment-faire/markdown-performance-images/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>L'optimisation des images est l'un des moyens les plus efficaces d'améliorer les performances de votre site web.</p>
<p>Cecil gère automatiquement les optimisations suivantes pour les images Markdown :</p>
<ol>
<li><strong>Dimensions</strong> : Les dimensions des images sont définies pour garantir une mise en page correcte et éviter les décalages.</li>
<li><strong>Compression</strong> : L'image est compressée pour réduire la taille du fichier sans perte significative de qualité.</li>
<li><strong>Formats d'image</strong> : Cecil génère les formats AVIF et WebP pour l'image.</li>
<li><strong>Images responsives</strong> : Cecil génère deux tailles d'image différentes (selon la configuration) pour s'adapter à la taille des différents appareils.</li>
<li><strong>Chargement différé</strong> : L'image est configurée pour se charger de manière différée, c'est-à-dire uniquement lorsqu'elle apparaît dans la fenêtre d'affichage.</li>
<li><strong>Décodage</strong> : Le décodage de l'image est configuré pour être asynchrone, ce qui améliore le temps de chargement initial de la page.</li>
<li><strong>Espace réservé</strong> : Un espace réservé de couleur est utilisé pendant le chargement de l'image.</li>
</ol>
<aside class="note note-info"><p>Consultez la documentation pour plus de détails sur la <a href="/documentation/configuration/#assets-images">configuration des ressources globales</a> et la <a href="/documentation/configuration/#pages-body">configuration des pages</a>.</p></aside>
<h2 id="exemple">Exemple</h2>
<p>Ci-dessous un exemple avec une image PNG 1920x1276 pixels.</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="xml">![Une région de formation d’étoiles dans le ciel](../../assets/arnaud-girault-IjEtFjxXweE-unsplash.jpg "Photo de Arnaud Girault"){placeholder=color}</span></code></pre>
<figure>
<picture title="Photo de Arnaud Girault">
<source type="image/avif" srcset="/thumbnails/480x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 480w, /thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 768w, /thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 1024w" width="1024" height="681" sizes="100vw">
<source type="image/webp" srcset="/thumbnails/480x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 480w, /thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 768w, /thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 1024w" width="1024" height="681" sizes="100vw">
<img src="/thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg" alt="Une région de formation d’étoiles dans le ciel" loading="lazy" decoding="async" class="dark:brightness-90" width="1024" height="681" style=";max-width:100%;height:auto;background-color:rgb(30 41 43);" srcset="/thumbnails/480x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 480w, /thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 768w, /thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 1024w" sizes="100vw">
</picture>
<figcaption>Photo de <a href="https://unsplash.com/fr/photos/une-region-de-formation-detoiles-dans-le-ciel-IjEtFjxXweE" target="_blank" rel="noopener noreferrer">Arnaud Girault</a></figcaption>
</figure>
<h3 id="configuration">Configuration</h3>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-comment"># configuration globale des assets</span>
<span class="hljs-attr">assets:</span>
  <span class="hljs-attr">images:</span>
    <span class="hljs-attr">optimize:</span> <span class="hljs-literal">true</span>
    <span class="hljs-attr">responsive:</span>
      <span class="hljs-attr">widths:</span> <span class="hljs-string">[768,</span> <span class="hljs-number">1024</span><span class="hljs-string">]</span>
<span class="hljs-comment"># configuration des images dans du Markdown</span>
<span class="hljs-attr">pages:</span>
  <span class="hljs-attr">body:</span>
    <span class="hljs-attr">images:</span>
      <span class="hljs-attr">formats:</span> <span class="hljs-string">[avif,</span> <span class="hljs-string">webp]</span>
      <span class="hljs-attr">responsive:</span> <span class="hljs-literal">true</span>
      <span class="hljs-attr">lazy:</span> <span class="hljs-literal">true</span>
      <span class="hljs-attr">decoding:</span> <span class="hljs-literal">true</span>
      <span class="hljs-attr">placeholder:</span> <span class="hljs-string">color</span></code></pre>
<h3 id="html-genere">HTML généré</h3>
<pre><code class="language-html hljs xml" translate="no"><span class="hljs-tag">&lt;<span class="hljs-name">picture</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">source</span>
    <span class="hljs-attr">type</span>=<span class="hljs-string">"image/avif"</span>
    <span class="hljs-attr">srcset</span>=<span class="hljs-string">"/thumbnails/1024/arnaud-girault-IjEtFjxXweE-unsplash.c0bdd31264ac3d0d364d02bced31038f.avif 1024w,
            /thumbnails/768/arnaud-girault-IjEtFjxXweE-unsplash.c0bdd31264ac3d0d364d02bced31038f.avif 768w"</span>
    <span class="hljs-attr">sizes</span>=<span class="hljs-string">"100vw"</span>
    <span class="hljs-attr">width</span>=<span class="hljs-string">"1024"</span>
    <span class="hljs-attr">height</span>=<span class="hljs-string">"681"</span>
  &gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">source</span>
    <span class="hljs-attr">type</span>=<span class="hljs-string">"image/webp"</span>
    <span class="hljs-attr">srcset</span>=<span class="hljs-string">"/thumbnails/1024/arnaud-girault-IjEtFjxXweE-unsplash.c0bdd31264ac3d0d364d02bced31038f.webp 1024w,
            /thumbnails/768/arnaud-girault-IjEtFjxXweE-unsplash.c0bdd31264ac3d0d364d02bced31038f.webp 768w"</span>
    <span class="hljs-attr">sizes</span>=<span class="hljs-string">"100vw"</span>
    <span class="hljs-attr">width</span>=<span class="hljs-string">"1024"</span>
    <span class="hljs-attr">height</span>=<span class="hljs-string">"681"</span>
  &gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"/thumbnails/1024/arnaud-girault-IjEtFjxXweE-unsplash.c0bdd31264ac3d0d364d02bced31038f.jpg"</span>
    <span class="hljs-attr">alt</span>=<span class="hljs-string">"Photo de Arnaud Girault"</span>
    <span class="hljs-attr">loading</span>=<span class="hljs-string">"lazy"</span>
    <span class="hljs-attr">decoding</span>=<span class="hljs-string">"async"</span>
    <span class="hljs-attr">width</span>=<span class="hljs-string">"1024"</span>
    <span class="hljs-attr">height</span>=<span class="hljs-string">"681"</span>
    <span class="hljs-attr">style</span>=<span class="hljs-string">";max-width:100%;height:auto;background-color:rgb(58, 56, 44);"</span>
    <span class="hljs-attr">srcset</span>=<span class="hljs-string">"/thumbnails/1024/arnaud-girault-IjEtFjxXweE-unsplash.c0bdd31264ac3d0d364d02bced31038f.jpg 1024w,
            /thumbnails/768/arnaud-girault-IjEtFjxXweE-unsplash.c0bdd31264ac3d0d364d02bced31038f.jpg 768w"</span>
    <span class="hljs-attr">sizes</span>=<span class="hljs-string">"100vw"</span>
  &gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">picture</span>&gt;</span></code></pre>]]>
    </content>
  </entry>
  <entry xml:lang="fr">
    <id>https://cecil.app/fr/comment-faire/templates-image-formats/</id>
    <title>Générer plusieurs formats d&#039;images dans des modèles</title>
    <published>2025-07-25T00:00:00+00:00</published>
    <link href="https://cecil.app/fr/comment-faire/templates-image-formats/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Pour optimiser les performances et la bande passante, Cecil peut générer plusieurs formats d'image, tels qu'AVIF et WebP. Cela permet au navigateur de sélectionner le format le plus adapté à ses capacités :</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset('image.jpg'), attributes={alt: 'Description alternative'}, options={formats: ['avif', 'webp']}) }}</span></code></pre>
<blockquote>
<p>AVIF et WebP sont des formats d'image offrant des caractéristiques de compression et de qualité supérieures à leurs homologues JPEG et PNG plus anciens. Encoder vos images dans ces formats plutôt que JPEG ou PNG permet un chargement plus rapide et une consommation de données mobiles réduite.</p>
<p>AVIF est pris en charge par Chrome, Firefox et Opera et offre des tailles de fichier plus petites que d'autres formats à qualité égale.</p>
<p>WebP est pris en charge par les dernières versions de Chrome, Firefox, Safari, Edge et Opera et offre une meilleure compression avec et sans perte pour les images sur le Web.</p>
</blockquote>
<p>– <a href="https://developer.chrome.com/docs/lighthouse/performance/uses-webp-images?hl=fr" target="_blank" rel="noopener noreferrer">Documentation Chrome Lighthouse</a></p>
<h2 id="exemple">Exemple</h2>
<p>Ci-dessous un exemple de génération des formats AVIF et WebP d'une image :</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset('cecil-logo.png'), attributes={alt: 'Cecil logo'}, options={formats: ['avif', 'webp']}) }}</span></code></pre>
<h3 id="html-genere">HTML généré</h3>
<pre><code class="language-html hljs xml" translate="no"><span class="hljs-tag">&lt;<span class="hljs-name">picture</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">source</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"image/avif"</span> <span class="hljs-attr">srcset</span>=<span class="hljs-string">"/cecil-logo.c1af8a129a0cde81f9b94ffbf452e10b.avif"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">source</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"image/webp"</span> <span class="hljs-attr">srcset</span>=<span class="hljs-string">"/cecil-logo.c1af8a129a0cde81f9b94ffbf452e10b.webp"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"/cecil-logo.c1af8a129a0cde81f9b94ffbf452e10b.png"</span> <span class="hljs-attr">width</span>=<span class="hljs-string">"250"</span> <span class="hljs-attr">height</span>=<span class="hljs-string">"250"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">"Cecil logo"</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">picture</span>&gt;</span></code></pre>]]>
    </content>
  </entry>
  <entry xml:lang="fr">
    <id>https://cecil.app/fr/comment-faire/templates-responsive-images/</id>
    <title>Rendre des images réactives dans des modèles</title>
    <published>2025-07-25T00:00:00+00:00</published>
    <link href="https://cecil.app/fr/comment-faire/templates-responsive-images/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>La manière la plus simple de rendre des <a href="https://developer.mozilla.org/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images" target="_blank" rel="noopener noreferrer">images réactives</a> dans des modèles est d'utiliser la <a href="/documentation/templates/#html">fonction html</a> :</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset('image.jpg'), attributes={alt: 'Description alternative'}, options={responsive: true}) }}</span></code></pre>
<aside class="note note-important"><p>Les valeurs de largeur par défaut des images générées sont 480, 640, 768, 1024, 1366, 1600 et 1920. Elles peuvent être modifiées dans la section <em>assets</em> de la <a href="/documentation/configuration/#assets-images">configuration</a>.</p></aside>
<h2 id="exemple">Exemple</h2>
<p>Ci-dessous un exemple avec une image PNG 1000x1000 pixels.</p>
<pre><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset('cecil-logo-1000.png'), attributes={alt: 'Cecil logo'}, options={responsive: true}) }}</span></code></pre>
<h3 id="configuration">Configuration</h3>
<pre><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">assets:</span>
  <span class="hljs-attr">images:</span>
    <span class="hljs-attr">responsive:</span>
      <span class="hljs-attr">widths:</span> <span class="hljs-string">[768,</span> <span class="hljs-number">1024</span><span class="hljs-string">]</span></code></pre>
<h3 id="html-genere">HTML généré</h3>
<pre><code class="language-html hljs xml" translate="no"><span class="hljs-tag">&lt;<span class="hljs-name">img</span>
  <span class="hljs-attr">alt</span>=<span class="hljs-string">"Cecil logo"</span>
  <span class="hljs-attr">width</span>=<span class="hljs-string">"1000"</span>
  <span class="hljs-attr">height</span>=<span class="hljs-string">"1000"</span>
  <span class="hljs-attr">src</span>=<span class="hljs-string">"/cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png"</span>
  <span class="hljs-attr">srcset</span>=<span class="hljs-string">"/thumbnails/768/cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png 768w,
          /cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png 1000w"</span>
  <span class="hljs-attr">sizes</span>=<span class="hljs-string">"100vw"</span>
&gt;</span></code></pre>]]>
    </content>
  </entry>
</feed>
