<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="https://cecil.app/xsl/atom.xsl" media="all"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <id>https://cecil.app/how-to/</id>
  <title>Cecil - How to?</title>
  <subtitle><![CDATA[Cecil is a command-line PHP application that merges Markdown pages, media and Twig templates to generate a static website.]]></subtitle>
  <link href="https://cecil.app/how-to/atom.xml" rel="self" type="application/atom+xml" />
  <link href="https://cecil.app/how-to/" rel="alternate" type="text/html" />
  <updated>2026-11-18T20:40:16+00:00</updated>
  <author>
    <name>Cecil</name>
    <uri>https://cecil.app</uri>
  </author>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/extend-pages-generator/</id>
    <title>Create a custom pages generator</title>
    <published>2026-10-22T00:00:00+00:00</published>
    <updated>2026-10-26T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/extend-pages-generator/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>A pages generator creates pages without Markdown files (for example from an API or a database), or alters existing pages. Cecil uses its own generators to build sections, taxonomies, pagination, etc., and you can add yours.</p>
<h2 id="create-the-generator-class">Create the generator class<a class="heading-anchor" href="#create-the-generator-class" aria-hidden="true" tabindex="-1"></a></h2>
<p>Add a PHP class in the <code translate="no">extensions</code> directory of your site, with your own namespace (e.g.: <code translate="no">MySite\Generator</code>, the <code translate="no">Cecil\</code> namespace being reserved). It extends <code translate="no">AbstractGenerator</code>, implements <code translate="no">GeneratorInterface</code>, and adds pages to <code translate="no">$this-&gt;generatedPages</code> in the <code translate="no">generate()</code> method.</p>
<aside class="note note-tip"><p>The <a href="https://cecil.app/documentation/commands/new-extension/"><code translate="no">new:extension</code></a> command creates the skeleton of the class, and displays the configuration to enable it: <code translate="no">php cecil.phar new:extension --type=generator --name=Posts --namespace=MySite</code>.</p></aside>
<p>The following example creates one page per item returned by a JSON API:</p>
<p><em>extensions/MySite/Generator/Posts.php</em></p>
<pre data-lang="php"><code class="language-php hljs php" translate="no"><span class="hljs-meta">&lt;?php</span>
<span class="hljs-keyword">namespace</span> <span class="hljs-title">MySite</span>\<span class="hljs-title">Generator</span>;

<span class="hljs-keyword">use</span> <span class="hljs-title">Cecil</span>\<span class="hljs-title">Collection</span>\<span class="hljs-title">Page</span>\<span class="hljs-title">Page</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Cecil</span>\<span class="hljs-title">Collection</span>\<span class="hljs-title">Page</span>\<span class="hljs-title">Type</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Cecil</span>\<span class="hljs-title">Generator</span>\<span class="hljs-title">AbstractGenerator</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Cecil</span>\<span class="hljs-title">Generator</span>\<span class="hljs-title">GeneratorInterface</span>;

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Posts</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">AbstractGenerator</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">GeneratorInterface</span>
</span>{
    <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">generate</span><span class="hljs-params">()</span>: <span class="hljs-title">void</span>
    </span>{
        $posts = json_decode(file_get_contents(<span class="hljs-string">'https://jsonplaceholder.typicode.com/posts'</span>), <span class="hljs-keyword">true</span>) ?? [];

        <span class="hljs-keyword">foreach</span> ($posts <span class="hljs-keyword">as</span> $post) {
            $page = (<span class="hljs-keyword">new</span> Page(<span class="hljs-string">"posts/{$post['id']}"</span>))
                -&gt;setType(Type::PAGE)
                -&gt;setPath(<span class="hljs-string">"posts/{$post['id']}"</span>)
                -&gt;setSection(<span class="hljs-string">'posts'</span>)
                -&gt;setBodyHtml(<span class="hljs-string">'&lt;p&gt;'</span> . htmlspecialchars($post[<span class="hljs-string">'body'</span>]) . <span class="hljs-string">'&lt;/p&gt;'</span>)
                -&gt;setVariable(<span class="hljs-string">'title'</span>, $post[<span class="hljs-string">'title'</span>]);
            <span class="hljs-keyword">$this</span>-&gt;generatedPages-&gt;add($page);
        }
    }
}</code></pre>
<aside class="note note-tip"><p>Existing pages (from Markdown files and previous generators) are available through <code translate="no">$this-&gt;builder-&gt;getPages()</code>, and the configuration through <code translate="no">$this-&gt;config</code>.</p></aside>
<h2 id="register-the-generator">Register the generator<a class="heading-anchor" href="#register-the-generator" aria-hidden="true" tabindex="-1"></a></h2>
<p>Add the class name to the <a href="https://cecil.app/documentation/configuration/pages/#pages-generators"><code translate="no">pages.generators</code></a> map in <code translate="no">cecil.yml</code>, indexed by a name, with its priority:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">generators:</span>
    <span class="hljs-attr">Posts:</span> <span class="hljs-string">{</span> <span class="hljs-attr">class:</span> <span class="hljs-string">MySite\Generator\Posts,</span> <span class="hljs-attr">priority:</span> <span class="hljs-number">35</span> <span class="hljs-string">}</span></code></pre>
<p>Generators run in ascending priority order. The built-in ones use priorities from <code translate="no">10</code> (<code translate="no">DefaultPages</code>) to <code translate="no">90</code> (<code translate="no">Redirect</code>): with <code translate="no">35</code>, the generated pages are created before sections (<code translate="no">40</code>), so thanks to <code translate="no">setSection()</code> they are grouped in the <code translate="no">posts</code> section like pages from Markdown files.</p>
<aside class="note note-info"><p>Without <code translate="no">setSection()</code>, pages created by a generator don’t belong to any section. Like any other page, they are listed in <code translate="no">site.pages.showable</code> and in the sitemap: set the <code translate="no">excluded</code> variable to <code translate="no">true</code> to keep a page out of lists.</p></aside>
<h2 id="build">Build<a class="heading-anchor" href="#build" aria-hidden="true" tabindex="-1"></a></h2>
<pre data-lang="bash"><code class="language-bash hljs bash" translate="no">php cecil.phar build</code></pre>
<p>The pages are now available at <code translate="no">/posts/1/</code>, <code translate="no">/posts/2/</code>, etc., rendered with the default <code translate="no">page</code> templates.</p>
<aside class="note note-info"><p>See the <a href="https://cecil.app/documentation/developers/extend/#page-generators">pages generator documentation</a> for another example, using a SQLite database.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/extend-twig-extension/</id>
    <title>Add a custom Twig function or filter</title>
    <published>2026-10-21T00:00:00+00:00</published>
    <updated>2026-10-26T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/extend-twig-extension/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil provides many template <a href="https://cecil.app/documentation/templates/reference/functions/">functions</a> and <a href="https://cecil.app/documentation/templates/reference/filters/">filters</a>, but you can add your own with a <a href="https://twig.symfony.com/doc/advanced.html#creating-an-extension" target="_blank" rel="noopener noreferrer">Twig extension</a> written in PHP.</p>
<h2 id="create-the-extension-class">Create the extension class<a class="heading-anchor" href="#create-the-extension-class" aria-hidden="true" tabindex="-1"></a></h2>
<p>Add a PHP file in the <code translate="no">extensions</code> directory of your site, with your own namespace (e.g.: <code translate="no">MySite\Twig</code>, the <code translate="no">Cecil\</code> namespace being reserved), the file path matching the namespace:</p>
<p><em>extensions/MySite/Twig/MyTwigExtension.php</em></p>
<pre data-lang="php"><code class="language-php hljs php" translate="no"><span class="hljs-meta">&lt;?php</span>
<span class="hljs-keyword">namespace</span> <span class="hljs-title">MySite</span>\<span class="hljs-title">Twig</span>;

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyTwigExtension</span> <span class="hljs-keyword">extends</span> \<span class="hljs-title">Twig</span>\<span class="hljs-title">Extension</span>\<span class="hljs-title">AbstractExtension</span>
</span>{
    <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getFilters</span><span class="hljs-params">()</span>: <span class="hljs-title">array</span>
    </span>{
        <span class="hljs-keyword">return</span> [
            <span class="hljs-comment">// {{ 'text'|md5 }}</span>
            <span class="hljs-keyword">new</span> \Twig\TwigFilter(<span class="hljs-string">'md5'</span>, <span class="hljs-string">'md5'</span>),
            <span class="hljs-comment">// {{ page.content|word_count }}</span>
            <span class="hljs-keyword">new</span> \Twig\TwigFilter(<span class="hljs-string">'word_count'</span>, [<span class="hljs-keyword">$this</span>, <span class="hljs-string">'wordCount'</span>]),
        ];
    }

    <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getFunctions</span><span class="hljs-params">()</span>: <span class="hljs-title">array</span>
    </span>{
        <span class="hljs-keyword">return</span> [
            <span class="hljs-comment">// {{ year() }}</span>
            <span class="hljs-keyword">new</span> \Twig\TwigFunction(<span class="hljs-string">'year'</span>, fn () =&gt; date(<span class="hljs-string">'Y'</span>)),
        ];
    }

    <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">wordCount</span><span class="hljs-params">(string $html)</span>: <span class="hljs-title">int</span>
    </span>{
        <span class="hljs-keyword">return</span> str_word_count(strip_tags($html));
    }
}</code></pre>
<aside class="note note-tip"><p>The <a href="https://cecil.app/documentation/commands/new-extension/"><code translate="no">new:extension</code></a> command creates the skeleton of the class: <code translate="no">php cecil.phar new:extension --type=twig --name=MyTwigExtension --namespace=MySite</code>.</p></aside>
<h2 id="register-the-extension">Register the extension<a class="heading-anchor" href="#register-the-extension" aria-hidden="true" tabindex="-1"></a></h2>
<p>Add the class name to the <code translate="no">layouts.extensions</code> map in <code translate="no">cecil.yml</code>, indexed by a name of your choice:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">layouts:</span>
  <span class="hljs-attr">extensions:</span>
    <span class="hljs-attr">MyExtension:</span> <span class="hljs-string">MySite\Twig\MyTwigExtension</span></code></pre>
<h2 id="use-it-in-templates">Use it in templates<a class="heading-anchor" href="#use-it-in-templates" aria-hidden="true" tabindex="-1"></a></h2>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span></span><span class="hljs-template-variable">{{ page.content|word_count }}</span><span class="xml"> words<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">footer</span>&gt;</span>© </span><span class="hljs-template-variable">{{ year() }}</span><span class="xml"> </span><span class="hljs-template-variable">{{ site.title }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">footer</span>&gt;</span></span></code></pre>
<aside class="note note-tip"><p>Run the build with the <code translate="no">-vvv</code> option to check that the extension is loaded: Cecil logs <code translate="no">Extension "MyExtension" (layouts.extensions) loaded</code>, or an error if the class can’t be loaded. See the <a href="https://cecil.app/documentation/developers/extend/#twig-extension">Twig extension documentation</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/templates-fragments-cache/</id>
    <title>Speed up builds with fragments cache</title>
    <published>2026-10-20T00:00:00+00:00</published>
    <link href="https://cecil.app/how-to/templates-fragments-cache/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Some parts of a layout (footer, sidebar, list of latest posts, etc.) are identical on every page but are rendered again for each of them. With the <em>fragments</em> cache, Cecil renders such a part once per build and language, then reuses the result for the other pages.</p>
<h2 id="wrap-content-with-the-cache-tag">Wrap content with the cache tag<a class="heading-anchor" href="#wrap-content-with-the-cache-tag" aria-hidden="true" tabindex="-1"></a></h2>
<p>Surround the cacheable part of a template with the <a href="https://twig.symfony.com/doc/tags/cache.html" target="_blank" rel="noopener noreferrer"><code translate="no">cache</code> tag</a> and a key built with the <code translate="no">cache_key</code> function:</p>
<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('footer') %}</span><span class="xml">
  <span class="hljs-tag">&lt;<span class="hljs-name">footer</span>&gt;</span>
    </span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">for</span></span> entry in site.menus.footer|sort_by_weight %}</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(entry.url) }}</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><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">footer</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name">endcache</span> %}</span></code></pre>
<h2 id="build-the-cache-key">Build the cache key<a class="heading-anchor" href="#build-the-cache-key" aria-hidden="true" tabindex="-1"></a></h2>
<p>The <code translate="no">cache_key</code> function builds a key from a name, an optional value, the current language and the build ID:</p>
<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('sidebar', page.section) %}</span><span class="xml">
  </span><span class="hljs-comment">{# cacheable content #}</span><span class="xml">
</span><span class="hljs-template-tag">{% <span class="hljs-name">endcache</span> %}</span></code></pre>
<ul>
<li>the language ensures that each language gets its own fragment</li>
<li>the build ID changes on every build, so a fragment is rendered once per build and never reused by a later build</li>
<li>the optional value (string, array or object) is hashed and added to the key, to keep several variants of the same fragment, for example one per section</li>
</ul>
<aside class="note note-warning"><p><em>Fragments</em> cache is stored on disk and has no expiration. With a fixed key such as <code translate="no">{% cache 'footer' %}</code>, the fragment is shared by every language and reused by the next builds, so pages can display outdated or wrong-language content until the cache is cleared. Always use <code translate="no">cache_key</code>.</p></aside>
<h2 id="example-latest-posts-sidebar">Example: latest posts sidebar<a class="heading-anchor" href="#example-latest-posts-sidebar" aria-hidden="true" tabindex="-1"></a></h2>
<p>The list below is rendered once per build and language, then reused by every page that includes it:</p>
<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('latest-posts') %}</span><span class="xml">
  <span class="hljs-tag">&lt;<span class="hljs-name">aside</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>Latest posts<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
    </span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">for</span></span> post in site.pages.showable|filter_by('section', 'blog')|sort_by_date|<span class="hljs-keyword">slice</span>(0, 5) %}</span><span class="xml">
      <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(post) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span></span><span class="hljs-template-variable">{{ post.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>
    </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">ul</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">aside</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name">endcache</span> %}</span></code></pre>
<aside class="note note-warning"><p>Do not cache content that depends on the current page (e.g. active menu item, page title), or include a page value (like <code translate="no">page.id</code>) in the key.</p></aside>
<h2 id="clear-the-cache">Clear the cache<a class="heading-anchor" href="#clear-the-cache" aria-hidden="true" tabindex="-1"></a></h2>
<p>Clear only the fragments cache:</p>
<pre data-lang="bash"><code class="language-bash hljs bash" translate="no">php cecil.phar cache:clear:templates --fragments</code></pre>
<p>Or clear the whole templates cache, or all caches:</p>
<pre data-lang="bash"><code class="language-bash hljs bash" translate="no">php cecil.phar cache:clear:templates
php cecil.phar cache:clear</code></pre>
<p>During local development, you can also clear the cache before each build:</p>
<pre data-lang="bash"><code class="language-bash hljs bash" translate="no">php cecil.phar serve --clear-cache</code></pre>
<aside class="note note-info"><p>See the documentation of <a href="https://cecil.app/documentation/templates/cache/#fragments-cache">fragments cache</a>, the <a href="https://cecil.app/documentation/templates/reference/functions/#cache-key"><code translate="no">cache_key</code> function</a> and the <a href="https://cecil.app/documentation/configuration/cache/">cache configuration</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/content-data-files/</id>
    <title>Generate pages from data files</title>
    <published>2026-10-19T00:00:00+00:00</published>
    <updated>2026-10-26T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/content-data-files/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Data files are a convenient way to manage structured content (team members, products, events, etc.) outside of pages, then display it with templates.</p>
<h2 id="add-a-data-file">Add a data file<a class="heading-anchor" href="#add-a-data-file" aria-hidden="true" tabindex="-1"></a></h2>
<p>Store your files in the <code translate="no">data</code> directory. Supported formats are YAML, JSON, XML and CSV.</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-comment"># data/team.yml</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Ada</span>
  <span class="hljs-attr">role:</span> <span class="hljs-string">Developer</span>
<span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Grace</span>
  <span class="hljs-attr">role:</span> <span class="hljs-string">Designer</span></code></pre>
<aside class="note note-tip"><p>A localized version can be added with a language suffix (e.g. <code translate="no">data/team.fr.yml</code>): it is used for the pages in that language.</p>
<p>As soon as a language has at least one localized data file, <code translate="no">site.data</code> only contains the localized files for that language: non-localized files are no longer available to its pages.</p></aside>
<h2 id="display-data-in-a-template">Display data in a template<a class="heading-anchor" href="#display-data-in-a-template" aria-hidden="true" tabindex="-1"></a></h2>
<p>The file is available in templates with <code translate="no">site.data.&lt;filename&gt;</code>, e.g. <code translate="no">layouts/team.html.twig</code>:</p>
<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">

</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">block</span></span> content %}</span><span class="xml">
  <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>
  <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
  </span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">for</span></span> member in site.data.team %}</span><span class="xml">
    <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span></span><span class="hljs-template-variable">{{ member.name }}</span><span class="xml">, </span><span class="hljs-template-variable">{{ member.role }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
  </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">ul</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endblock</span></span> %}</span></code></pre>
<p>Files in sub-directories are nested: <code translate="no">data/galleries/gallery-1.json</code> is available with <code translate="no">site.data.galleries['gallery-1']</code>.</p>
<h2 id="create-the-page">Create the page<a class="heading-anchor" href="#create-the-page" aria-hidden="true" tabindex="-1"></a></h2>
<p>The page that uses this template doesn’t need any content, so declare it as a <a href="https://cecil.app/documentation/configuration/pages/#pages-default">default page</a> in <code translate="no">cecil.yml</code>, indexed by ID:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">default:</span>
    <span class="hljs-attr">team:</span>
      <span class="hljs-attr">path:</span> <span class="hljs-string">team</span>
      <span class="hljs-attr">title:</span> <span class="hljs-string">Our</span> <span class="hljs-string">team</span>
      <span class="hljs-attr">layout:</span> <span class="hljs-string">team</span></code></pre>
<p>You can also create a <code translate="no">pages/team.md</code> file with <code translate="no">layout: team</code> in its front matter.</p>
<h2 id="generate-one-page-per-item">Generate one page per item<a class="heading-anchor" href="#generate-one-page-per-item" aria-hidden="true" tabindex="-1"></a></h2>
<p>To generate a page per entry, create a <a href="https://cecil.app/documentation/developers/extend/#page-generators">pages generator</a>. Data loaded from data files is available with <code translate="no">$this-&gt;builder-&gt;getData()</code>:</p>
<pre data-lang="php"><code class="language-php hljs php" translate="no"><span class="hljs-meta">&lt;?php</span>
<span class="hljs-comment">// extensions/MySite/Generator/Team.php</span>
<span class="hljs-keyword">namespace</span> <span class="hljs-title">MySite</span>\<span class="hljs-title">Generator</span>;

<span class="hljs-keyword">use</span> <span class="hljs-title">Cecil</span>\<span class="hljs-title">Collection</span>\<span class="hljs-title">Page</span>\<span class="hljs-title">Page</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Cecil</span>\<span class="hljs-title">Collection</span>\<span class="hljs-title">Page</span>\<span class="hljs-title">Type</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Cecil</span>\<span class="hljs-title">Generator</span>\<span class="hljs-title">AbstractGenerator</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Cecil</span>\<span class="hljs-title">Generator</span>\<span class="hljs-title">GeneratorInterface</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">Cecil</span>\<span class="hljs-title">Util</span>\<span class="hljs-title">Slugifier</span>;

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Team</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">AbstractGenerator</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">GeneratorInterface</span>
</span>{
    <span class="hljs-keyword">public</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">generate</span><span class="hljs-params">()</span>: <span class="hljs-title">void</span>
    </span>{
        $data = <span class="hljs-keyword">$this</span>-&gt;builder-&gt;getData(<span class="hljs-keyword">$this</span>-&gt;config-&gt;getLanguageDefault());
        <span class="hljs-keyword">foreach</span> ($data[<span class="hljs-string">'team'</span>] ?? [] <span class="hljs-keyword">as</span> $member) {
            $slug = Slugifier::slugify($member[<span class="hljs-string">'name'</span>]);
            $page = (<span class="hljs-keyword">new</span> Page(<span class="hljs-string">"team/$slug"</span>))
                -&gt;setType(Type::PAGE)
                -&gt;setPath(<span class="hljs-string">"team/$slug"</span>)
                -&gt;setSection(<span class="hljs-string">'team'</span>)
                -&gt;setBodyHtml(<span class="hljs-string">'&lt;p&gt;'</span> . htmlspecialchars($member[<span class="hljs-string">'role'</span>]) . <span class="hljs-string">'&lt;/p&gt;'</span>)
                -&gt;setVariable(<span class="hljs-string">'title'</span>, $member[<span class="hljs-string">'name'</span>]);
            <span class="hljs-keyword">$this</span>-&gt;generatedPages-&gt;add($page);
        }
    }
}</code></pre>
<p>Then register it:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">generators:</span>
    <span class="hljs-attr">Team:</span> <span class="hljs-string">{</span> <span class="hljs-attr">class:</span> <span class="hljs-string">MySite\Generator\Team,</span> <span class="hljs-attr">priority:</span> <span class="hljs-number">25</span> <span class="hljs-string">}</span></code></pre>
<aside class="note note-info"><p>Pages created by a generator don’t belong to any section: <code translate="no">setSection()</code> is required to group them in the <code translate="no">team</code> section. Like any other page, they are listed in <code translate="no">site.pages.showable</code> and in the sitemap: set the <code translate="no">excluded</code> variable to <code translate="no">true</code> to keep a page out of lists.</p></aside>
<aside class="note note-info"><p>See the documentation of <a href="https://cecil.app/documentation/configuration/data-static/#data">data configuration</a>, the <a href="https://cecil.app/documentation/templates/variables/#site-data"><code translate="no">site.data</code> variable</a> and <a href="https://cecil.app/documentation/developers/extend/#page-generators">pages generators</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/templates-components/</id>
    <title>Use Twig components</title>
    <published>2026-10-18T00:00:00+00:00</published>
    <link href="https://cecil.app/how-to/templates-components/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Components are small reusable Twig templates (button, card, alert, etc.) called with a dedicated tag: they accept attributes and can wrap any content.</p>
<h2 id="create-a-component">Create a component<a class="heading-anchor" href="#create-a-component" aria-hidden="true" tabindex="-1"></a></h2>
<p>Components are Twig templates stored in the <code translate="no">components/</code> subdirectory of your layouts directory. Create <code translate="no">layouts/components/button.twig</code>:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="xml"><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>
  </span><span class="hljs-template-variable">{{ slot }}</span><span class="xml">
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span></code></pre>
<ul>
<li><code translate="no">slot</code> contains the content added between the opening and the closing tags</li>
<li><code translate="no">attributes</code> contains the attributes passed to the component, and <code translate="no">merge()</code> combines them with default values</li>
</ul>
<h2 id="use-the-component">Use the component<a class="heading-anchor" href="#use-the-component" aria-hidden="true" tabindex="-1"></a></h2>
<p>Call the component with the <code translate="no">x</code> tag followed by <code translate="no">:</code> and the file name of the component, without extension:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="hljs-template-tag">{% <span class="hljs-name">x</span>:button with {class: 'text-white'} %}</span><span class="xml">
  <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>
</span><span class="hljs-template-tag">{% <span class="hljs-name">endx</span> %}</span></code></pre>
<p>It will render:</p>
<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>
  <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>
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></code></pre>
<h2 id="pass-variables">Pass variables<a class="heading-anchor" href="#pass-variables" aria-hidden="true" tabindex="-1"></a></h2>
<p>Values passed with <code translate="no">with</code> are also available as variables inside the component. For example, <code translate="no">layouts/components/card.twig</code>:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">article</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"card"</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">{{ href }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span></span><span class="hljs-template-variable">{{ 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><span class="hljs-template-variable">{{ slot }}</span><span class="xml">
<span class="hljs-tag">&lt;/<span class="hljs-name">article</span>&gt;</span></span></code></pre>
<p>Use it in a list template:</p>
<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 page.pages.showable %}</span><span class="xml">
  </span><span class="hljs-template-tag">{% <span class="hljs-name">x</span>:card with {href: url(p), title: p.title} %}</span><span class="xml">
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span></span><span class="hljs-template-variable">{{ p.description }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
  </span><span class="hljs-template-tag">{% <span class="hljs-name">endx</span> %}</span><span class="xml">
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endfor</span></span> %}</span></code></pre>
<h2 id="change-the-components-directory">Change the components directory<a class="heading-anchor" href="#change-the-components-directory" aria-hidden="true" tabindex="-1"></a></h2>
<p>The directory and file extension of components can be changed in <code translate="no">cecil.yml</code>:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">layouts:</span>
  <span class="hljs-attr">components:</span>
    <span class="hljs-attr">dir:</span> <span class="hljs-string">components</span> <span class="hljs-comment"># components source directory</span>
    <span class="hljs-attr">ext:</span> <span class="hljs-string">twig</span>       <span class="hljs-comment"># components files extension</span></code></pre>
<aside class="note note-info"><p>See the documentation of <a href="https://cecil.app/documentation/templates/components/">components</a> and the <a href="https://cecil.app/documentation/configuration/layouts/#layouts-components">components configuration</a>. The feature is provided by the <a href="https://github.com/giorgiopogliani/twig-components" target="_blank" rel="noopener noreferrer">Twig components extension</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/content-schedule/</id>
    <title>Schedule the publication of a page</title>
    <published>2026-10-17T00:00:00+00:00</published>
    <updated>2026-10-18T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/content-schedule/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>With the <code translate="no">schedule</code> variable, a page can be written in advance and published later, or removed from the site after a given date.</p>
<h2 id="publish-a-page-at-a-date">Publish a page at a date<a class="heading-anchor" href="#publish-a-page-at-a-date" aria-hidden="true" tabindex="-1"></a></h2>
<p>The page is published only if the build date is on or after the <code translate="no">publish</code> date:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">Product</span> <span class="hljs-string">launch</span>
<span class="hljs-attr">schedule:</span>
  <span class="hljs-attr">publish:</span> <span class="hljs-number">2026</span><span class="hljs-number">-11</span><span class="hljs-number">-15</span>
<span class="hljs-meta">---</span></code></pre>
<h2 id="unpublish-a-page-after-a-date">Unpublish a page after a date<a class="heading-anchor" href="#unpublish-a-page-after-a-date" aria-hidden="true" tabindex="-1"></a></h2>
<p>The page is published only if the build date is before the <code translate="no">expiry</code> date. As a date without time means midnight, the page is already unpublished on the expiry day itself (add a time, e.g. <code translate="no">2026-08-31 23:59:59</code>, to keep it during that day):</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">Summer</span> <span class="hljs-string">sale</span>
<span class="hljs-attr">schedule:</span>
  <span class="hljs-attr">expiry:</span> <span class="hljs-number">2026</span><span class="hljs-number">-08</span><span class="hljs-number">-31</span>
<span class="hljs-meta">---</span></code></pre>
<h2 id="publish-a-page-between-two-dates">Publish a page between two dates<a class="heading-anchor" href="#publish-a-page-between-two-dates" aria-hidden="true" tabindex="-1"></a></h2>
<p>Combine both dates: the page is published only if the <code translate="no">publish</code> date is reached <strong>and</strong> the <code translate="no">expiry</code> date is not passed:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">Black</span> <span class="hljs-string">Friday</span>
<span class="hljs-attr">schedule:</span>
  <span class="hljs-attr">publish:</span> <span class="hljs-number">2026</span><span class="hljs-number">-11</span><span class="hljs-number">-27</span>
  <span class="hljs-attr">expiry:</span> <span class="hljs-number">2026</span><span class="hljs-number">-12</span><span class="hljs-number">-01</span>
<span class="hljs-meta">---</span></code></pre>
<h2 id="rebuild-the-site-regularly">Rebuild the site regularly<a class="heading-anchor" href="#rebuild-the-site-regularly" aria-hidden="true" tabindex="-1"></a></h2>
<p>A static site doesn’t change by itself: the schedule is evaluated <strong>at build time</strong>. A page planned for November 15 will appear only after a build that runs on or after that date.</p>
<p>To make it automatic, rebuild the site every day. For example, with <a href="https://cecil.app/documentation/deploy/continuous-deployment/#github-pages">GitHub Pages</a>, add a <code translate="no">schedule</code> trigger to the <code translate="no">on</code> section of your workflow:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-comment"># .github/workflows/build-and-deploy.yml</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">schedule:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">cron:</span> <span class="hljs-string">'0 6 * * *'</span> <span class="hljs-comment"># every day at 6:00 UTC</span>
  <span class="hljs-attr">workflow_dispatch:</span></code></pre>
<p>On public repositories, GitHub disables scheduled workflows after 60 days without activity in the repository.</p>
<p>Most Jamstack platforms provide a similar feature (scheduled builds or build hooks triggered by a cron job).</p>
<aside class="note note-tip"><p>To check the result locally, run <code translate="no">php cecil.phar build --show-pages</code> and look for your page in the list of built pages.</p></aside>
<aside class="note note-info"><p>See the documentation of the <a href="https://cecil.app/documentation/content/front-matter/#schedule"><code translate="no">schedule</code> variable</a> and of <a href="https://cecil.app/documentation/deploy/continuous-deployment/#github-pages">continuous deployment</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/output-sitemap-robots/</id>
    <title>Customize sitemap and robots.txt</title>
    <published>2026-10-16T00:00:00+00:00</published>
    <updated>2026-10-20T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/output-sitemap-robots/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil automatically generates <code translate="no">/sitemap.xml</code> and <code translate="no">/robots.txt</code>: they are <a href="https://cecil.app/documentation/configuration/pages/#pages-default">default pages</a> rendered with the built-in templates <code translate="no">_default/sitemap.xml.twig</code> and <code translate="no">_default/robots.txt.twig</code>.</p>
<h2 id="how-it-works">How it works<a class="heading-anchor" href="#how-it-works" aria-hidden="true" tabindex="-1"></a></h2>
<p>The two pages are declared in the default configuration:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">default:</span>
    <span class="hljs-attr">robots:</span>
      <span class="hljs-attr">path:</span> <span class="hljs-string">robots</span>
      <span class="hljs-attr">layout:</span> <span class="hljs-string">robots</span>
      <span class="hljs-attr">output:</span> <span class="hljs-string">txt</span>
    <span class="hljs-attr">sitemap:</span>
      <span class="hljs-attr">path:</span> <span class="hljs-string">sitemap</span>
      <span class="hljs-attr">layout:</span> <span class="hljs-string">sitemap</span>
      <span class="hljs-attr">output:</span> <span class="hljs-string">xml</span>
      <span class="hljs-attr">changefreq:</span> <span class="hljs-string">monthly</span>
      <span class="hljs-attr">priority:</span> <span class="hljs-number">0.5</span></code></pre>
<ul>
<li>the <strong>sitemap</strong> lists all showable pages (published, not paginated, not redirected, not excluded), including sections and taxonomies, with their translations;</li>
<li><strong>robots.txt</strong> allows everything, disallows redirect pages and the 404 page, and points to the sitemap.</li>
</ul>
<aside class="note note-important"><p>Set <a href="https://cecil.app/documentation/configuration/site/#baseurl"><code translate="no">baseurl</code></a> in <code translate="no">cecil.yml</code>: both files use absolute URLs.</p></aside>
<h2 id="exclude-a-page-from-the-sitemap">Exclude a page from the sitemap<a class="heading-anchor" href="#exclude-a-page-from-the-sitemap" aria-hidden="true" tabindex="-1"></a></h2>
<p>Add <a href="https://cecil.app/documentation/content/front-matter/#excluded"><code translate="no">excluded</code></a> to the page front matter:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">Thank</span> <span class="hljs-string">you</span>
<span class="hljs-attr">excluded:</span> <span class="hljs-literal">true</span>
<span class="hljs-meta">---</span></code></pre>
<p>The page is still published, but hidden from the sitemap and from list pages (home page, sections, etc.). Use <code translate="no">published: false</code> to not publish it at all.</p>
<h2 id="change-the-default-frequency-and-priority">Change the default frequency and priority<a class="heading-anchor" href="#change-the-default-frequency-and-priority" aria-hidden="true" tabindex="-1"></a></h2>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">default:</span>
    <span class="hljs-attr">sitemap:</span>
      <span class="hljs-attr">changefreq:</span> <span class="hljs-string">weekly</span>
      <span class="hljs-attr">priority:</span> <span class="hljs-number">0.8</span></code></pre>
<p>You can also set them per page, in the front matter:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">News</span>
<span class="hljs-attr">sitemap:</span>
  <span class="hljs-attr">changefreq:</span> <span class="hljs-string">daily</span>
  <span class="hljs-attr">priority:</span> <span class="hljs-number">0.9</span>
<span class="hljs-meta">---</span></code></pre>
<aside class="note note-info"><p>Pages with a custom canonical URL (<code translate="no">canonical.url</code> in the front matter) are not listed in the sitemap.</p></aside>
<h2 id="add-rules-to-robots-txt">Add rules to robots.txt<a class="heading-anchor" href="#add-rules-to-robots-txt" aria-hidden="true" tabindex="-1"></a></h2>
<p>Create a <code translate="no">pages/robots.md</code> page: its body is appended to the generated rules. As it replaces the default <code translate="no">robots</code> page, set <code translate="no">excluded: true</code> to keep it out of the sitemap and list pages.</p>
<pre data-lang="markdown"><code class="language-markdown hljs markdown" translate="no">---
layout: robots
excluded: true
<span class="hljs-section">output: txt
---</span>
User-agent: GPTBot
Disallow: /</code></pre>
<h2 id="override-the-templates">Override the templates<a class="heading-anchor" href="#override-the-templates" aria-hidden="true" tabindex="-1"></a></h2>
<p>Extract the <a href="https://cecil.app/documentation/templates/lookup-rules/#built-in-templates">built-in templates</a> to start from the originals:</p>
<pre data-lang="bash"><code class="language-bash hljs bash" translate="no">php cecil.phar util:templates:extract</code></pre>
<p>Or create <code translate="no">layouts/sitemap.xml.twig</code> (or <code translate="no">layouts/robots.txt.twig</code>) from scratch. For example, a sitemap that also skips pages with a custom <code translate="no">sitemap_exclude</code> front matter variable:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="xml"><span class="hljs-meta">&lt;?xml version="1.0" encoding="utf-8"?&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">urlset</span> <span class="hljs-attr">xmlns</span>=<span class="hljs-string">"http://www.sitemaps.org/schemas/sitemap/0.9"</span>&gt;</span>
  </span><span class="hljs-template-tag">{%- <span class="hljs-name"><span class="hljs-keyword">for</span></span> p in site.pages.showable|<span class="hljs-keyword">filter</span>(p =&gt; not p.sitemap_exclude|<span class="hljs-keyword">default</span>(false))|sort_by_date ~%}</span><span class="xml">
  <span class="hljs-tag">&lt;<span class="hljs-name">url</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">loc</span>&gt;</span></span><span class="hljs-template-variable">{{ url(p, {canonical: true}) }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">loc</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">lastmod</span>&gt;</span></span><span class="hljs-template-variable">{{ p.<span class="hljs-name">date</span>|<span class="hljs-keyword">date</span>('Y-m-d') }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">lastmod</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">url</span>&gt;</span>
  </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">urlset</span>&gt;</span></span></code></pre>
<aside class="note note-tip"><p>To disable one of these files, unpublish its default page:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">default:</span>
    <span class="hljs-attr">sitemap:</span>
      <span class="hljs-attr">published:</span> <span class="hljs-literal">false</span></code></pre></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/templates-lqip-placeholder/</id>
    <title>Display image placeholders while loading</title>
    <published>2026-10-15T00:00:00+00:00</published>
    <updated>2026-10-18T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/templates-lqip-placeholder/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Images are often the heaviest resources of a page. While they load, Cecil can fill their space with a <strong>dominant color</strong> or a <strong>Low-Quality Image Placeholder</strong> (LQIP), to avoid empty blocks and improve perceived performance.</p>
<h2 id="with-the-html-function">With the html function<a class="heading-anchor" href="#with-the-html-function" aria-hidden="true" tabindex="-1"></a></h2>
<p>The simplest way is the <code translate="no">placeholder</code> option of the <code translate="no">html</code> function, set to <code translate="no">color</code> or <code translate="no">lqip</code>:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset('images/photo.jpg'), {alt: 'Description', loading: 'lazy'}, {placeholder: 'lqip'}) }}</span></code></pre>
<p>To apply it to every image rendered with <code translate="no">html</code>, set a default in <code translate="no">cecil.yml</code>:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">layouts:</span>
  <span class="hljs-attr">images:</span>
    <span class="hljs-attr">placeholder:</span> <span class="hljs-string">color</span> <span class="hljs-comment"># `color` or `lqip`</span></code></pre>
<aside class="note note-important"><p>The <code translate="no">placeholder</code> option of the <code translate="no">html</code> function only applies to JPEG, PNG and GIF images, and the <code translate="no">lqip</code> placeholder is ignored for animated GIFs.</p></aside>
<h2 id="with-filters">With filters<a class="heading-anchor" href="#with-filters" aria-hidden="true" tabindex="-1"></a></h2>
<p>For custom markup, use the filters directly:</p>
<ul>
<li><code translate="no">lqip</code>: returns a tiny blurred version of the image as a data URL</li>
<li><code translate="no">dominant_color</code>: returns the dominant color of the image as a CSS color value (e.g. <code translate="no">rgb(120 85 60)</code>)</li>
</ul>
<h3 id="dominant-color">Dominant color<a class="heading-anchor" href="#dominant-color" aria-hidden="true" tabindex="-1"></a></h3>
<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('images/photo.jpg') %}</span><span class="xml">
<span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ url(image) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">width</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ image.width }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">height</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ image.height }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">"Description"</span> <span class="hljs-attr">loading</span>=<span class="hljs-string">"lazy"</span>
  <span class="hljs-attr">style</span>=<span class="hljs-string">"background-color: </span></span></span><span class="hljs-template-variable">{{ image|dominant_color }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">;"</span>&gt;</span></span></code></pre>
<h3 id="blurred-preview">Blurred preview<a class="heading-anchor" href="#blurred-preview" aria-hidden="true" tabindex="-1"></a></h3>
<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('images/photo.jpg') %}</span><span class="xml">
<span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ url(image) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">width</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ image.width }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">height</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ image.height }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">"Description"</span> <span class="hljs-attr">loading</span>=<span class="hljs-string">"lazy"</span>
  <span class="hljs-attr">class</span>=<span class="hljs-string">"placeholder"</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"background-image: url(</span></span></span><span class="hljs-template-variable">{{ image|lqip }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">);"</span>&gt;</span></span></code></pre>
<p>Stretch the preview over the image area with CSS:</p>
<pre data-lang="css"><code class="language-css hljs css" translate="no"><span class="hljs-selector-tag">img</span><span class="hljs-selector-class">.placeholder</span> {
  <span class="hljs-attribute">max-width</span>: <span class="hljs-number">100%</span>;
  <span class="hljs-attribute">height</span>: auto;
  <span class="hljs-attribute">background-size</span>: cover;
  <span class="hljs-attribute">background-repeat</span>: no-repeat;
}</code></pre>
<p>The background is visible until the real image is loaded and painted over it.</p>
<aside class="note note-tip"><p>Images in Markdown support placeholders too: <code translate="no">![](/images/photo.jpg){placeholder=lqip}</code>, or globally with the <a href="https://cecil.app/documentation/configuration/pages/#pages-body-images"><code translate="no">pages.body.images.placeholder</code> option</a>.</p></aside>
<aside class="note note-info"><p>See the documentation of the <a href="https://cecil.app/documentation/assets/images/#lqip"><code translate="no">lqip</code> filter</a>, the <a href="https://cecil.app/documentation/assets/images/#dominant-color"><code translate="no">dominant_color</code> filter</a> and the <a href="https://cecil.app/documentation/templates/reference/functions/#html"><code translate="no">html</code> function</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/markdown-toc-notes/</id>
    <title>Add a table of contents and notes</title>
    <published>2026-10-14T00:00:00+00:00</published>
    <updated>2026-10-16T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/markdown-toc-notes/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil extends Markdown with a few handy features for long pages: an automatic table of contents, note blocks and attributes on elements.</p>
<h2 id="insert-a-table-of-contents">Insert a table of contents<a class="heading-anchor" href="#insert-a-table-of-contents" aria-hidden="true" tabindex="-1"></a></h2>
<p>Add the <code translate="no">[toc]</code> tag where the table of contents should appear in the body of the page:</p>
<pre data-lang="markdown"><code class="language-markdown hljs markdown" translate="no">[toc]

<span class="hljs-section">## Installation</span>
<span class="hljs-section">### Requirements</span>
<span class="hljs-section">## Usage</span></code></pre>
<p>By default, the table of contents is built from H2 and H3 headings. Change it in <code translate="no">cecil.yml</code>:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">body:</span>
    <span class="hljs-attr">toc:</span> <span class="hljs-string">[h2,</span> <span class="hljs-string">h3,</span> <span class="hljs-string">h4]</span></code></pre>
<h2 id="display-the-table-of-contents-in-a-template">Display the table of contents in a template<a class="heading-anchor" href="#display-the-table-of-contents-in-a-template" aria-hidden="true" tabindex="-1"></a></h2>
<p>To place the table of contents outside the content (e.g. in a sidebar), use the <code translate="no">toc</code> filter on the page body:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">aside</span>&gt;</span>
  </span><span class="hljs-template-variable">{{ page.body|toc }}</span><span class="xml">
<span class="hljs-tag">&lt;/<span class="hljs-name">aside</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">article</span>&gt;</span>
  </span><span class="hljs-template-variable">{{ page.content }}</span><span class="xml">
<span class="hljs-tag">&lt;/<span class="hljs-name">article</span>&gt;</span></span></code></pre>
<p>The filter also accepts the headings to extract, e.g. <code translate="no">{{ page.body|toc(selectors=['h2']) }}</code>.</p>
<h2 id="add-notes">Add notes<a class="heading-anchor" href="#add-notes" aria-hidden="true" tabindex="-1"></a></h2>
<p>Highlight information with a note block:</p>
<pre data-lang="markdown"><code class="language-markdown hljs markdown" translate="no">:::tip
<span class="hljs-strong">**Tip:**</span> This is advice.
:::</code></pre>
<p>It is converted to:</p>
<pre data-lang="html"><code class="language-html hljs xml" translate="no"><span class="hljs-tag">&lt;<span class="hljs-name">aside</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"note note-tip"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">strong</span>&gt;</span>Tip:<span class="hljs-tag">&lt;/<span class="hljs-name">strong</span>&gt;</span> This is advice.
  <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">aside</span>&gt;</span></code></pre>
<p>Available types are <code translate="no">info</code>, <code translate="no">tip</code>, <code translate="no">important</code>, <code translate="no">warning</code> and <code translate="no">caution</code> (or no type). Style them with the <code translate="no">note</code> and <code translate="no">note-&lt;type&gt;</code> CSS classes.</p>
<p>To nest notes, use a longer fence for the parent note (<code translate="no">::::</code>, then <code translate="no">:::::</code> for a third level, etc.):</p>
<pre data-lang="markdown"><code class="language-markdown hljs markdown" translate="no">::::info
Before.

:::tip
<span class="hljs-strong">**Tip:**</span> This is advice.
:::

After.
::::</code></pre>
<p>Cecil also provides note templates to structure content without JavaScript: <code translate="no">tabs</code>, <code translate="no">code-group</code>, <code translate="no">steps</code>, <code translate="no">accordion</code> and <code translate="no">cards</code>. Their items are defined with <code translate="no">####</code> headings (or list entries for <code translate="no">cards</code>), and each type is rendered with the <code translate="no">partials/notes/&lt;type&gt;.html.twig</code> template, which you can override.</p>
<h2 id="add-attributes">Add attributes<a class="heading-anchor" href="#add-attributes" aria-hidden="true" tabindex="-1"></a></h2>
<p>Set an id, a class or any attribute on a heading, a fenced code block, a link or an image, inside curly braces at the end of the line:</p>
<pre data-lang="markdown"><code class="language-markdown hljs markdown" translate="no"><span class="hljs-section">## Installation {#install .highlighted}</span></code></pre>
<p>The <code translate="no">#install</code> id gives a stable anchor to link to: <code translate="no">[See installation](#install)</code>.</p>
<aside class="note note-warning"><p>For an inline element, like a link, add a line break after the closing brace.</p></aside>
<aside class="note note-info"><p>See the documentation of the <a href="https://cecil.app/documentation/content/markdown/#table-of-contents">table of contents</a>, <a href="https://cecil.app/documentation/content/markdown/#notes">notes</a> and their <a href="https://cecil.app/documentation/content/markdown/#templates">templates</a>, <a href="https://cecil.app/documentation/content/markdown/#attributes">attributes</a> and the <a href="https://cecil.app/documentation/templates/reference/filters/#toc"><code translate="no">toc</code> filter</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/content-redirect-alias/</id>
    <title>Redirect old URLs</title>
    <published>2026-10-13T00:00:00+00:00</published>
    <updated>2026-10-20T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/content-redirect-alias/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>When a page moves or is renamed, its old URL should not lead to a 404 error. Cecil provides two front matter variables to handle this: <code translate="no">alias</code> and <code translate="no">redirect</code>.</p>
<h2 id="redirect-old-urls-to-a-page">Redirect old URLs to a page<a class="heading-anchor" href="#redirect-old-urls-to-a-page" aria-hidden="true" tabindex="-1"></a></h2>
<p>The <code translate="no">alias</code> variable lists the old paths of the current page. Each of them redirects to the page:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">About</span>
<span class="hljs-attr">alias:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">company</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">about-us</span>
<span class="hljs-meta">---</span></code></pre>
<p>In this example, <code translate="no">/company/</code> and <code translate="no">/about-us/</code> redirect to <code translate="no">/about/</code>.</p>
<h2 id="redirect-a-page-to-another-url">Redirect a page to another URL<a class="heading-anchor" href="#redirect-a-page-to-another-url" aria-hidden="true" tabindex="-1"></a></h2>
<p>The <code translate="no">redirect</code> variable turns a page into a redirection to the given URL, internal or external:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">Old</span> <span class="hljs-string">documentation</span>
<span class="hljs-attr">redirect:</span> <span class="hljs-string">"https://cecil.app/documentation/"</span>
<span class="hljs-meta">---</span></code></pre>
<h2 id="without-a-markdown-file">Without a Markdown file<a class="heading-anchor" href="#without-a-markdown-file" aria-hidden="true" tabindex="-1"></a></h2>
<p>If the old page has no content anymore, declare it as a <a href="https://cecil.app/documentation/configuration/pages/#pages-default">default page</a> in <code translate="no">cecil.yml</code>, indexed by ID:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">pages:</span>
  <span class="hljs-attr">default:</span>
    <span class="hljs-attr">code:</span>
      <span class="hljs-attr">path:</span> <span class="hljs-string">code</span>
      <span class="hljs-attr">redirect:</span> <span class="hljs-string">https://github.com/Cecilapp/Cecil</span></code></pre>
<h2 id="generated-pages">Generated pages<a class="heading-anchor" href="#generated-pages" aria-hidden="true" tabindex="-1"></a></h2>
<p>For each alias and each redirection, Cecil renders a page with the built-in <a href="https://github.com/Cecilapp/Cecil/blob/main/resources/layouts/_default/redirect.html.twig" target="_blank" rel="noopener noreferrer"><code translate="no">redirect.html.twig</code></a> template. It contains:</p>
<ul>
<li>a <code translate="no">&lt;link rel="canonical"&gt;</code> to the target URL</li>
<li>a <code translate="no">&lt;meta name="robots" content="noindex"&gt;</code> tag, so search engines don’t index it</li>
<li>a <code translate="no">&lt;meta http-equiv="refresh"&gt;</code> tag and a JavaScript redirection</li>
<li>a fallback link for visitors</li>
</ul>
<aside class="note note-tip"><p>To customize this page, create your own <code translate="no">layouts/redirect.html.twig</code> template: it takes precedence over the built-in one.</p></aside>
<aside class="note note-info"><p>See the documentation of the <a href="https://cecil.app/documentation/content/front-matter/#redirect"><code translate="no">redirect</code></a> and <a href="https://cecil.app/documentation/content/front-matter/#alias"><code translate="no">alias</code></a> variables.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/config-environments/</id>
    <title>Use different settings per environment</title>
    <published>2026-10-12T00:00:00+00:00</published>
    <updated>2026-10-18T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/config-environments/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Your local site and your production site rarely share the same settings: base URL, debug mode, output directory… Cecil lets you keep a single <code translate="no">cecil.yml</code> and override it per environment.</p>
<h2 id="keep-production-values-in-cecil-yml">Keep production values in <code translate="no">cecil.yml</code><a class="heading-anchor" href="#keep-production-values-in-cecil-yml" aria-hidden="true" tabindex="-1"></a></h2>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">title:</span> <span class="hljs-string">"My site"</span>
<span class="hljs-attr">baseurl:</span> <span class="hljs-string">https://example.com/</span>
<span class="hljs-attr">debug:</span> <span class="hljs-literal">false</span></code></pre>
<h2 id="override-with-extra-config-files">Override with extra config files<a class="heading-anchor" href="#override-with-extra-config-files" aria-hidden="true" tabindex="-1"></a></h2>
<p>Create a file with only the keys to change, for example <code translate="no">config/dev.yml</code>:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">debug:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">cache:</span>
  <span class="hljs-attr">enabled:</span> <span class="hljs-literal">false</span></code></pre>
<p>Then load it with the <code translate="no">--config</code> option, available with the <code translate="no">build</code> and <code translate="no">serve</code> commands:</p>
<pre data-lang="bash"><code class="language-bash hljs bash" translate="no">php cecil.phar serve --config=config/dev.yml</code></pre>
<aside class="note note-info"><p>You don’t need to set <code translate="no">baseurl</code> for local preview: the <code translate="no">serve</code> command builds the site with its own local URL (e.g. <code translate="no">http://localhost:8000/</code>), unless the <code translate="no">CECIL_BASEURL</code> environment variable is set, including in a <code translate="no">.env</code> file (see below).</p></aside>
<p>You can pass several files, separated by commas. They are merged in order after <code translate="no">cecil.yml</code>, so each file overrides the previous ones:</p>
<pre data-lang="bash"><code class="language-bash hljs bash" translate="no">php cecil.phar build --config=config/prod.yml,config/local.yml</code></pre>
<aside class="note note-warning"><p>Lists of values are replaced, not merged: if <code translate="no">cecil.yml</code> defines <code translate="no">pages.body.toc: [h2, h3]</code> and an extra file defines <code translate="no">pages.body.toc: [h4]</code>, the result is <code translate="no">[h4]</code>. To add or remove a value instead, use a map of booleans (e.g. <code translate="no">pages.body.toc: {h4: true}</code>). Lists of entries, such as menus, are concatenated. See <a href="https://cecil.app/documentation/configuration/#lists">lists</a>.</p></aside>
<h2 id="override-with-environment-variables">Override with environment variables<a class="heading-anchor" href="#override-with-environment-variables" aria-hidden="true" tabindex="-1"></a></h2>
<p>Any configuration key can be set with an environment variable prefixed with <code translate="no">CECIL_</code>, in uppercase. Nested keys are separated with an underscore (e.g. <code translate="no">CECIL_OUTPUT_DIR</code> sets <code translate="no">output.dir</code>):</p>
<pre data-lang="bash"><code class="language-bash hljs bash" translate="no"><span class="hljs-built_in">export</span> CECIL_BASEURL=<span class="hljs-string">"https://staging.example.com/"</span>
<span class="hljs-built_in">export</span> CECIL_DEBUG=<span class="hljs-literal">true</span>
php cecil.phar build</code></pre>
<aside class="note note-info"><p>As each underscore is turned into a dot, keys that contain an underscore (e.g. <code translate="no">pages.body.images.dark_suffix</code>) can’t be set with an environment variable.</p></aside>
<p>Cecil also loads a <code translate="no">.env</code> file from the site root, if it exists (variables already defined by the system are preserved):</p>
<pre data-lang="dotenv"><code class="language-dotenv" translate="no">CECIL_TITLE="My site (preview)"
CECIL_DEBUG=true</code></pre>
<p>Environment variables are applied last, on top of the configuration files <strong>and</strong> of command options such as <code translate="no">--baseurl</code>, which makes them handy in CI, for example:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-comment"># .gitlab-ci.yml</span>
<span class="hljs-attr">pages:</span>
  <span class="hljs-attr">variables:</span>
    <span class="hljs-attr">CECIL_ENV:</span> <span class="hljs-string">production</span>
    <span class="hljs-attr">CECIL_OUTPUT_DIR:</span> <span class="hljs-string">public</span></code></pre>
<h2 id="read-the-environment-in-templates">Read the environment in templates<a class="heading-anchor" href="#read-the-environment-in-templates" aria-hidden="true" tabindex="-1"></a></h2>
<p>Use the <code translate="no">getenv</code> function to adapt templates, for example to include analytics in production only:</p>
<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> getenv('CECIL_ENV') == 'production' %}</span><span class="xml">
  </span><span class="hljs-template-variable">{{ <span class="hljs-name">include</span><span class="hljs-params">('partials/analytics.html.twig')</span> }}</span><span class="xml">
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endif</span></span> %}</span></code></pre>
<p>The <code translate="no">site.debug</code> variable tells you if debug mode is enabled:</p>
<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> site.debug %}</span><span class="hljs-template-variable">{{ <span class="hljs-name">dump</span><span class="hljs-params">(page)</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>See the documentation for <a href="https://cecil.app/documentation/configuration/override/">overriding the configuration</a>, the <a href="https://cecil.app/documentation/configuration/site/#debug"><code translate="no">debug</code> option</a> and the <a href="https://cecil.app/documentation/templates/reference/functions/#getenv"><code translate="no">getenv</code> function</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/templates-assets-scss/</id>
    <title>Compile, minify and fingerprint CSS and JavaScript</title>
    <published>2026-10-11T00:00:00+00:00</published>
    <updated>2026-10-16T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/templates-assets-scss/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil can compile <a href="https://sass-lang.com" target="_blank" rel="noopener noreferrer">Sass</a> files, minify CSS and JavaScript, and add a content hash to file names (cache busting) directly from your templates, without any external build tool.</p>
<h2 id="configure-asset-processing">Configure asset processing<a class="heading-anchor" href="#configure-asset-processing" aria-hidden="true" tabindex="-1"></a></h2>
<p>Source files are stored in the <code translate="no">assets/</code> directory. Processing is enabled by default and can be tuned in <code translate="no">cecil.yml</code>:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">assets:</span>
  <span class="hljs-attr">compile:</span>
    <span class="hljs-attr">style:</span> <span class="hljs-string">compressed</span>                  <span class="hljs-comment"># `expanded` (default) or `compressed`</span>
    <span class="hljs-attr">import:</span> <span class="hljs-string">[sass,</span> <span class="hljs-string">scss,</span> <span class="hljs-string">node_modules]</span> <span class="hljs-comment"># imported directories (default)</span>
  <span class="hljs-attr">minify:</span> <span class="hljs-literal">true</span>                         <span class="hljs-comment"># minifies CSS and JS</span>
  <span class="hljs-attr">fingerprint:</span> <span class="hljs-literal">true</span>                    <span class="hljs-comment"># adds content hash to file names</span></code></pre>
<h2 id="load-a-stylesheet">Load a stylesheet<a class="heading-anchor" href="#load-a-stylesheet" aria-hidden="true" tabindex="-1"></a></h2>
<p>Create an <em>asset</em> from a Sass file and render the <code translate="no">&lt;link&gt;</code> element with the <code translate="no">html</code> function. The Sass file is compiled to CSS, then minified and fingerprinted according to the configuration:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset('css/styles.scss')) }}</span></code></pre>
<p>Filters can be chained to apply each step explicitly, which is useful if a feature (such as <code translate="no">minify</code> or <code translate="no">fingerprint</code>) is disabled globally:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ asset('css/styles.scss')|to_css|minify|fingerprint }}</span></code></pre>
<h2 id="bundle-javascript-files">Bundle JavaScript files<a class="heading-anchor" href="#bundle-javascript-files" aria-hidden="true" tabindex="-1"></a></h2>
<p>Pass an array of paths to create a single bundle, with a custom file name:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset(['js/menu.js', 'js/search.js'], {filename: 'scripts.js'})) }}</span></code></pre>
<p>Options can also be set per asset, for example to skip the minification of a remote file that is already minified:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset('https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.3.1/anchor.<span class="hljs-name">min</span>.js', {minify: false})) }}</span></code></pre>
<h2 id="add-subresource-integrity">Add Subresource Integrity<a class="heading-anchor" href="#add-subresource-integrity" aria-hidden="true" tabindex="-1"></a></h2>
<p>Use the <code translate="no">integrity</code> function (or the <code translate="no">integrity</code> attribute of the asset) to generate a <code translate="no">sha384</code> hash:</p>
<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> styles = asset('css/styles.scss') %}</span><span class="xml">
<span class="hljs-tag">&lt;<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"stylesheet"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ url(styles) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">integrity</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ integrity(styles) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">crossorigin</span>=<span class="hljs-string">"anonymous"</span>&gt;</span></span></code></pre>
<h2 id="inline-critical-css">Inline critical CSS<a class="heading-anchor" href="#inline-critical-css" aria-hidden="true" tabindex="-1"></a></h2>
<p>Output the content of an asset with the <code translate="no">inline</code> filter:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">style</span>&gt;</span></span><span class="hljs-template-variable">{{ asset('css/critical.scss')|to_css|minify|inline }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">style</span>&gt;</span></span></code></pre>
<p>For a few lines of styles written directly in the template, use the <code translate="no">scss_to_css</code> and <code translate="no">minify_css</code> filters:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">style</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">apply</span></span> scss_to_css|minify_css %}</span><span class="xml">
  $color: #fcfcfc;
  body {
    background-color: $color;
  }
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endapply</span></span> %}</span><span class="xml">
<span class="hljs-tag">&lt;/<span class="hljs-name">style</span>&gt;</span></span></code></pre>
<aside class="note note-info"><p>See the documentation of the <a href="https://cecil.app/documentation/assets/#asset"><code translate="no">asset</code> function</a>, the <a href="https://cecil.app/documentation/assets/#integrity"><code translate="no">integrity</code> function</a>, the <a href="https://cecil.app/documentation/assets/processing/">processing filters</a> and the <a href="https://cecil.app/documentation/configuration/assets/">assets configuration</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/content-taxonomies/</id>
    <title>Organize pages with tags and categories</title>
    <published>2026-10-10T00:00:00+00:00</published>
    <updated>2026-10-16T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/content-taxonomies/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Taxonomies let you classify pages with terms (e.g. <code translate="no">PHP</code>) grouped in vocabularies (e.g. <code translate="no">tags</code>). Cecil then generates a page per vocabulary and a page per term.</p>
<h2 id="declare-vocabularies">Declare vocabularies<a class="heading-anchor" href="#declare-vocabularies" aria-hidden="true" tabindex="-1"></a></h2>
<p>Vocabularies are declared in <code translate="no">cecil.yml</code>, paired by plural and singular names:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">taxonomies:</span>
  <span class="hljs-attr">categories:</span> <span class="hljs-string">category</span>
  <span class="hljs-attr">tags:</span> <span class="hljs-string">tag</span></code></pre>
<aside class="note note-warning"><p>There are no default vocabularies: you must declare them to use them.</p></aside>
<h2 id="classify-pages">Classify pages<a class="heading-anchor" href="#classify-pages" aria-hidden="true" tabindex="-1"></a></h2>
<p>Add terms in the front matter of your pages, using the plural name of the vocabulary:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">My</span> <span class="hljs-string">first</span> <span class="hljs-string">post</span>
<span class="hljs-attr">categories:</span> <span class="hljs-string">["Development"]</span>
<span class="hljs-attr">tags:</span> <span class="hljs-string">["PHP",</span> <span class="hljs-string">"Static site"</span><span class="hljs-string">]</span>
<span class="hljs-meta">---</span></code></pre>
<p>Cecil generates:</p>
<ul>
<li><code translate="no">/tags/</code>: the list of the terms of the vocabulary</li>
<li><code translate="no">/tags/php/</code> and <code translate="no">/tags/static-site/</code>: the list of the pages of each term</li>
</ul>
<h2 id="customize-the-list-of-terms">Customize the list of terms<a class="heading-anchor" href="#customize-the-list-of-terms" aria-hidden="true" tabindex="-1"></a></h2>
<p>The <em>vocabulary</em> template is named after the <strong>plural</strong>, e.g. <code translate="no">layouts/taxonomy/tags.html.twig</code>:</p>
<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">

</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">block</span></span> content %}</span><span class="xml">
  <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>
  <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
  </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">
    <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, {language: site.language}) }}</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>
  </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">ul</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endblock</span></span> %}</span></code></pre>
<h2 id="customize-the-pages-of-a-term">Customize the pages of a term<a class="heading-anchor" href="#customize-the-pages-of-a-term" aria-hidden="true" tabindex="-1"></a></h2>
<p>The <em>term</em> template is named after the <strong>singular</strong>, e.g. <code translate="no">layouts/taxonomy/tag.html.twig</code>:</p>
<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">

</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">block</span></span> content %}</span><span class="xml">
  <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>
  </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">
    <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">article</span>&gt;</span>
  </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">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"</span></span></span><span class="hljs-template-variable">{{ url(page.plural, {language: site.language}) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span>All </span><span class="hljs-template-variable">{{ page.plural }}</span><span class="xml"><span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
</span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">endblock</span></span> %}</span></code></pre>
<h2 id="display-the-terms-of-a-page">Display the terms of a page<a class="heading-anchor" href="#display-the-terms-of-a-page" aria-hidden="true" tabindex="-1"></a></h2>
<p>In a page template, link each term to its page:</p>
<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> tag in page.tags ?? [] %}</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('tags/' ~ tag, {language: site.language}) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span></span><span class="hljs-template-variable">{{ tag }}</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>The <code translate="no">language</code> option keeps links in the current language on a multilingual site.</p>
<p>Or use the built-in partial: <code translate="no">{{ include('partials/terms-list.html.twig', {vocabulary: 'tags'}) }}</code>.</p>
<aside class="note note-info"><p>See the documentation of <a href="https://cecil.app/documentation/configuration/site/#taxonomies">taxonomies configuration</a>, <a href="https://cecil.app/documentation/templates/lookup-rules/#type-vocabulary">templates lookup rules</a> and <a href="https://cecil.app/documentation/templates/variables/#taxonomy">taxonomy variables</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/templates-menus/</id>
    <title>Build a navigation menu</title>
    <published>2026-10-09T00:00:00+00:00</published>
    <updated>2026-10-18T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/templates-menus/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil manages navigation menus as collections of entries (name, URL, weight) that you can declare in the configuration or directly in pages, then render anywhere in your templates.</p>
<h2 id="declare-entries-in-configuration">Declare entries in configuration<a class="heading-anchor" href="#declare-entries-in-configuration" aria-hidden="true" tabindex="-1"></a></h2>
<p>Add a <code translate="no">menus</code> section in <code translate="no">cecil.yml</code>. Each menu (e.g. <code translate="no">main</code>, <code translate="no">footer</code>) is a list of entries with a unique <code translate="no">id</code>:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">menus:</span>
  <span class="hljs-attr">main:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">id:</span> <span class="hljs-string">about</span>
      <span class="hljs-attr">name:</span> <span class="hljs-string">"About"</span>
      <span class="hljs-attr">url:</span> <span class="hljs-string">/about/</span>
      <span class="hljs-attr">weight:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">footer:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">id:</span> <span class="hljs-string">github</span>
      <span class="hljs-attr">name:</span> <span class="hljs-string">"GitHub"</span>
      <span class="hljs-attr">url:</span> <span class="hljs-string">https://github.com/Cecilapp/Cecil</span>
      <span class="hljs-attr">weight:</span> <span class="hljs-number">99</span></code></pre>
<aside class="note note-info"><p>A <code translate="no">main</code> menu is automatically created with the home page entry and the top-level section entries (unless they define their own <code translate="no">menu</code> variable).</p></aside>
<h2 id="add-a-page-from-its-front-matter">Add a page from its front matter<a class="heading-anchor" href="#add-a-page-from-its-front-matter" aria-hidden="true" tabindex="-1"></a></h2>
<p>A page can add itself to one or more menus with the <code translate="no">menu</code> variable. The entry name is the page <code translate="no">title</code> and the URL is the page path:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">Our</span> <span class="hljs-string">Expertise</span>
<span class="hljs-attr">menu:</span>
  <span class="hljs-attr">main:</span>
    <span class="hljs-attr">weight:</span> <span class="hljs-number">15</span>
  <span class="hljs-attr">footer:</span>
    <span class="hljs-attr">weight:</span> <span class="hljs-number">15</span>
    <span class="hljs-attr">name:</span> <span class="hljs-string">"Expertise"</span> <span class="hljs-comment"># override the entry name in this menu</span>
<span class="hljs-meta">---</span></code></pre>
<h2 id="override-or-disable-an-entry">Override or disable an entry<a class="heading-anchor" href="#override-or-disable-an-entry" aria-hidden="true" tabindex="-1"></a></h2>
<p>Use the page ID as <code translate="no">id</code> to override an existing entry, or <code translate="no">enabled: false</code> to remove it:</p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-attr">menus:</span>
  <span class="hljs-attr">main:</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">id:</span> <span class="hljs-string">index</span>
      <span class="hljs-attr">name:</span> <span class="hljs-string">"Home"</span>
      <span class="hljs-attr">weight:</span> <span class="hljs-number">1</span>
    <span class="hljs-bullet">-</span> <span class="hljs-attr">id:</span> <span class="hljs-string">about</span>
      <span class="hljs-attr">enabled:</span> <span class="hljs-literal">false</span></code></pre>
<h2 id="render-the-menu">Render the menu<a class="heading-anchor" href="#render-the-menu" aria-hidden="true" tabindex="-1"></a></h2>
<p>Loop over <code translate="no">site.menus.&lt;menu&gt;</code>, sorted by weight, and compare each entry ID with the current page ID to highlight the active item:</p>
<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>
  <span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
  </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">
    <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></span><span class="hljs-template-tag">{% <span class="hljs-name"><span class="hljs-keyword">if</span></span> entry.id == page.id %}</span><span class="xml"><span class="hljs-tag"> <span class="hljs-attr">aria-current</span>=<span class="hljs-string">"page"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"active"</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">{{ 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>
  </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">ul</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">nav</span>&gt;</span></span></code></pre>
<aside class="note note-important"><p>The ID of a page entry doesn't include the language prefix (e.g. <code translate="no">about</code> for the <code translate="no">fr/about</code> page), while <code translate="no">page.id</code> does. On a multilingual site, compare URLs instead: <code translate="no">{% if url(entry.url) == url(page) %}</code>.</p></aside>
<p>A single entry can also be reached by its ID:</p>
<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> site.menus.main.about 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(site.menus.main.about.url) }}</span><span class="xml"><span class="hljs-tag"><span class="hljs-string">"</span>&gt;</span></span><span class="hljs-template-variable">{{ site.menus.main.about.name }}</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></code></pre>
<aside class="note note-tip"><p>Cecil also provides a built-in partial, without active item highlighting: <code translate="no">{{ include('partials/navigation.html.twig', {menu: 'main'}) }}</code>.</p></aside>
<aside class="note note-info"><p>See the documentation of the <a href="https://cecil.app/documentation/configuration/site/#menus">menus configuration</a>, the <a href="https://cecil.app/documentation/content/front-matter/#menu"><code translate="no">menu</code> front matter variable</a> and the <a href="https://cecil.app/documentation/templates/variables/#site-menus"><code translate="no">site.menus</code> variable</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/output-search-index/</id>
    <title>Add client-side search</title>
    <published>2026-10-08T00:00:00+00:00</published>
    <updated>2026-10-20T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/output-search-index/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>A static site has no server-side search, but Cecil can generate a <strong>JSON index of your pages</strong> at build time. A few lines of JavaScript are then enough to search it in the browser.</p>
<h2 id="create-the-index-page">Create the index page<a class="heading-anchor" href="#create-the-index-page" aria-hidden="true" tabindex="-1"></a></h2>
<p>Create a page whose only <a href="https://cecil.app/documentation/content/front-matter/#output">output format</a> is <code translate="no">json</code>, with a dedicated layout:</p>
<p><em>pages/search.md</em></p>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-meta">---</span>
<span class="hljs-attr">title:</span> <span class="hljs-string">Search</span> <span class="hljs-string">index</span>
<span class="hljs-attr">layout:</span> <span class="hljs-string">search</span>
<span class="hljs-attr">output:</span> <span class="hljs-string">json</span>
<span class="hljs-attr">excluded:</span> <span class="hljs-literal">true</span>
<span class="hljs-meta">---</span></code></pre>
<p><a href="https://cecil.app/documentation/content/front-matter/#excluded"><code translate="no">excluded: true</code></a> keeps this technical page out of list pages and the sitemap.</p>
<h2 id="write-the-json-template">Write the JSON template<a class="heading-anchor" href="#write-the-json-template" aria-hidden="true" tabindex="-1"></a></h2>
<p>Following the <a href="https://cecil.app/documentation/templates/lookup-rules/#lookup-rules">lookup rules</a>, Cecil renders this page with <code translate="no">layouts/search.json.twig</code>. Build an array of the <a href="https://cecil.app/documentation/templates/variables/#site">showable</a> pages, then encode it:</p>
<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> index = [] -%}</span><span class="xml">
</span><span class="hljs-template-tag">{%- <span class="hljs-name"><span class="hljs-keyword">for</span></span> p in site.pages.showable|<span class="hljs-keyword">filter</span>(p =&gt; p.type == 'page') -%}</span><span class="xml">
  </span><span class="hljs-template-tag">{%- <span class="hljs-name"><span class="hljs-keyword">set</span></span> index = index|<span class="hljs-keyword">merge</span>([{
    title: p.title,
    url: url(p),
    description: p.description|<span class="hljs-keyword">default</span>(''),
    content: p.content|<span class="hljs-keyword">striptags</span>|excerpt(300)
  }]) -%}</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><span class="hljs-template-variable">{{ index|<span class="hljs-keyword">json_encode</span>(<span class="hljs-name">constant</span><span class="hljs-params">('JSON_UNESCAPED_UNICODE')</span> b-or <span class="hljs-name">constant</span><span class="hljs-params">('JSON_UNESCAPED_SLASHES')</span>)|<span class="hljs-keyword">raw</span> }}</span></code></pre>
<p>After <code translate="no">php cecil.phar build</code>, the index is available at <code translate="no">/search.json</code>.</p>
<aside class="note note-info"><p><code translate="no">site.pages.showable</code> also includes pages without content file: the <code translate="no">p.type == 'page'</code> filter keeps sections and taxonomies out of the index, but pages created by a generator or declared in <code translate="no">pages.default</code> are indexed, unless they have <code translate="no">excluded: true</code>.</p></aside>
<h2 id="search-with-fuse-js">Search with Fuse.js<a class="heading-anchor" href="#search-with-fuse-js" aria-hidden="true" tabindex="-1"></a></h2>
<p>Add a search field to a template and load <a href="https://www.fusejs.io" target="_blank" rel="noopener noreferrer">Fuse.js</a> from a CDN to query the index:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"search"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"search"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Search…"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">ul</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"results"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span>&gt;</span><span class="javascript">
  <span class="hljs-keyword">import</span> Fuse <span class="hljs-keyword">from</span> <span class="hljs-string">'https://cdn.jsdelivr.net/npm/fuse.js@7/dist/fuse.mjs'</span>;

  <span class="hljs-keyword">const</span> index = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">'</span></span></span><span class="hljs-template-variable">{{ url('search', {format: 'json'}) }}</span><span class="xml">').then(r =&gt; r.json());
  const fuse = new Fuse(index, { keys: ['title', 'description', 'content'], threshold: 0.3 });
  const results = document.getElementById('results');

  document.getElementById('search').addEventListener('input', (e) =&gt; {
    results.replaceChildren(...fuse.search(e.target.value, { limit: 10 }).map(({ item }) =&gt; {
      const li = document.createElement('li');
      const a = document.createElement('a');
      a.href = item.url;
      a.textContent = item.title;
      li.append(a);
      return li;
    }));
  });
<span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></span></code></pre>
<h2 id="alternative-pagefind">Alternative: Pagefind<a class="heading-anchor" href="#alternative-pagefind" aria-hidden="true" tabindex="-1"></a></h2>
<p><a href="https://pagefind.app" target="_blank" rel="noopener noreferrer">Pagefind</a> indexes the generated HTML files instead: no JSON template is needed. Run it after the build, on the output directory (<code translate="no">_site</code> by default):</p>
<pre data-lang="bash"><code class="language-bash hljs bash" translate="no">php cecil.phar build
npx pagefind --site _site</code></pre>
<p>Then load its UI in a template:</p>
<pre data-lang="twig"><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">href</span>=<span class="hljs-string">"/pagefind/pagefind-ui.css"</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"stylesheet"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"/pagefind/pagefind-ui.js"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"search"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
  <span class="hljs-built_in">window</span>.addEventListener(<span class="hljs-string">'DOMContentLoaded'</span>, () =&gt; <span class="hljs-keyword">new</span> PagefindUI({ <span class="hljs-attr">element</span>: <span class="hljs-string">'#search'</span> }));
</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></span></code></pre>
<aside class="note note-tip"><p>The index is a regular page: to regenerate only JSON outputs, declare a <a href="https://cecil.app/documentation/configuration/pages/#pages-subsets">subset</a> and run <code translate="no">php cecil.phar build --render-subset=&lt;name&gt;</code>.</p></aside>
<aside class="note note-info"><p>See the <a href="https://cecil.app/documentation/content/front-matter/#output"><code translate="no">output</code> variable</a>, the <a href="https://cecil.app/documentation/configuration/output/#output-formats">output formats</a> and the <a href="https://cecil.app/documentation/templates/reference/functions/#url"><code translate="no">url</code> function</a> documentation.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/deploy-github-pages/</id>
    <title>Deploy to GitHub Pages with GitHub Actions</title>
    <published>2026-10-07T00:00:00+00:00</published>
    <updated>2026-10-16T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/deploy-github-pages/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>With the <a href="https://github.com/Cecilapp/Action" target="_blank" rel="noopener noreferrer">Cecil Action</a>, every push to your repository builds the site and publishes it to <strong>GitHub Pages</strong>, with no server to manage.</p>
<h2 id="enable-github-pages">Enable GitHub Pages<a class="heading-anchor" href="#enable-github-pages" aria-hidden="true" tabindex="-1"></a></h2>
<p>In your repository, go to <strong>Settings</strong> → <strong>Pages</strong> and, under <strong>Build and deployment</strong>, set <strong>Source</strong> to <strong>GitHub Actions</strong>.</p>
<h2 id="add-the-workflow">Add the workflow<a class="heading-anchor" href="#add-the-workflow" aria-hidden="true" tabindex="-1"></a></h2>
<p>Create the file <code translate="no">.github/workflows/build-and-deploy.yml</code>:</p>
<pre data-lang="yaml"><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@v7</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/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>The <code translate="no">build</code> job downloads Cecil, installs themes (if a <code translate="no">composer.json</code> file exists), builds the site and uploads the output directory as a Pages artifact. The <code translate="no">deploy</code> job then publishes it.</p>
<h2 id="base-url">Base URL<a class="heading-anchor" href="#base-url" aria-hidden="true" tabindex="-1"></a></h2>
<p>You don’t need to change <code translate="no">baseurl</code> in <code translate="no">cecil.yml</code>: the action builds the site with the URL provided by GitHub Pages (e.g. <code translate="no">https://&lt;user&gt;.github.io/&lt;repository&gt;/</code>), using the <code translate="no">--baseurl</code> option.</p>
<h2 id="customize-the-build">Customize the build<a class="heading-anchor" href="#customize-the-build" aria-hidden="true" tabindex="-1"></a></h2>
<p>The action accepts the following optional inputs:</p>
<pre data-lang="yaml"><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/Action@v4</span>
        <span class="hljs-attr">with:</span>
          <span class="hljs-attr">path:</span> <span class="hljs-string">docs</span>             <span class="hljs-comment"># site directory, relative to the repository root (`.` by default)</span>
          <span class="hljs-attr">version:</span> <span class="hljs-string">'9.13.0'</span>      <span class="hljs-comment"># Cecil version (latest by default)</span>
          <span class="hljs-attr">install_themes:</span> <span class="hljs-string">'no'</span>   <span class="hljs-comment"># skip themes installation (`yes` by default)</span>
          <span class="hljs-attr">options:</span> <span class="hljs-string">'-v --drafts'</span> <span class="hljs-comment"># build command options (`-v` by default)</span></code></pre>
<aside class="note note-warning"><p>The action uploads the <code translate="no">_site</code> directory of the site, or the directory given with the <code translate="no">--output</code> (<code translate="no">-o</code>) option in <code translate="no">options</code>: it doesn’t read <code translate="no">output.dir</code> from <code translate="no">cecil.yml</code>. If you change the output directory, pass it in <code translate="no">options</code>, e.g. <code translate="no">options: '-v --output=public'</code>.</p></aside>
<aside class="note note-tip"><p>To speed up builds, you can also restore and save the <code translate="no">.cache</code> directory between runs: see the full workflow in the <a href="https://cecil.app/documentation/deploy/continuous-deployment/#github-pages">GitHub Pages deployment documentation</a>, and the list of <a href="https://cecil.app/documentation/commands/build/">build options</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/output-rss-json-feed/</id>
    <title>Publish an RSS or JSON feed</title>
    <published>2026-10-06T00:00:00+00:00</published>
    <updated>2026-10-18T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/output-rss-json-feed/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil renders feeds with <strong>output formats</strong>: by default, the home page, sections and taxonomy terms are already published in HTML <strong>and Atom</strong> (e.g. <code translate="no">/atom.xml</code>, <code translate="no">/blog/atom.xml</code>). Add the <code translate="no">rss</code> or <code translate="no">jsonfeed</code> formats to publish RSS 2.0 or <a href="https://www.jsonfeed.org" target="_blank" rel="noopener noreferrer">JSON Feed</a> files too.</p>
<h2 id="enable-feeds-for-all-list-pages">Enable feeds for all list pages<a class="heading-anchor" href="#enable-feeds-for-all-list-pages" aria-hidden="true" tabindex="-1"></a></h2>
<p>Set the formats applied to each page type with <code translate="no">output.pagetypeformats</code>:</p>
<pre data-lang="yaml"><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 now generates <code translate="no">rss.xml</code> and <code translate="no">feed.json</code> next to each <code translate="no">index.html</code> of the home page and sections (e.g. <code translate="no">/blog/rss.xml</code>, <code translate="no">/blog/feed.json</code>).</p>
<p>The list replaces the default formats: keep <code translate="no">html</code> and <code translate="no">atom</code> in it. To only add formats to the defaults, use a map of booleans instead:</p>
<pre data-lang="yaml"><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">{rss:</span> <span class="hljs-literal">true</span><span class="hljs-string">,</span> <span class="hljs-attr">jsonfeed:</span> <span class="hljs-literal">true</span><span class="hljs-string">}</span>
    <span class="hljs-attr">section:</span> <span class="hljs-string">{rss:</span> <span class="hljs-literal">true</span><span class="hljs-string">,</span> <span class="hljs-attr">jsonfeed:</span> <span class="hljs-literal">true</span><span class="hljs-string">}</span></code></pre>
<aside class="note note-info"><p>See <a href="https://cecil.app/documentation/configuration/#lists">lists</a>, <a href="https://cecil.app/documentation/configuration/output/#output-pagetypeformats"><code translate="no">output.pagetypeformats</code></a> and the list of <a href="https://cecil.app/documentation/configuration/output/#default-formats">default formats</a>.</p></aside>
<h2 id="enable-a-feed-for-a-single-section">Enable a feed for a single section<a class="heading-anchor" href="#enable-a-feed-for-a-single-section" aria-hidden="true" tabindex="-1"></a></h2>
<p>To publish a feed only for one section, use the <a href="https://cecil.app/documentation/content/front-matter/#output"><code translate="no">output</code></a> variable in the front matter of the section index page. It replaces the default formats of the section, so keep <code translate="no">atom</code> in the list if you still want the Atom feed:</p>
<pre data-lang="yaml"><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">atom,</span> <span class="hljs-string">rss]</span>
<span class="hljs-meta">---</span></code></pre>
<h2 id="advertise-the-feed">Advertise the feed<a class="heading-anchor" href="#advertise-the-feed" aria-hidden="true" tabindex="-1"></a></h2>
<p>If your templates include the <a href="https://cecil.app/how-to/templates-metatags/">metatags partial</a> (see the <a href="https://cecil.app/documentation/configuration/site/#metatags"><code translate="no">metatags</code> configuration</a>), <code translate="no">&lt;link rel="alternate"&gt;</code> tags pointing to the feeds of the current page are added automatically in the <code translate="no">&lt;head&gt;</code>.</p>
<p>Otherwise, add the link yourself with the <code translate="no">url()</code> function and its <code translate="no">format</code> option:</p>
<pre data-lang="twig"><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="customize-the-feed-template">Customize the feed template<a class="heading-anchor" href="#customize-the-feed-template" aria-hidden="true" tabindex="-1"></a></h2>
<p>Feeds are rendered by the <a href="https://cecil.app/documentation/templates/lookup-rules/#built-in-templates">built-in templates</a> <code translate="no">_default/list.rss.twig</code>, <code translate="no">_default/list.atom.twig</code> and <code translate="no">_default/list.jsonfeed.twig</code>. Following the <a href="https://cecil.app/documentation/templates/lookup-rules/#lookup-rules">lookup rules</a>, create <code translate="no">layouts/list.rss.twig</code> (home page and sections) or <code translate="no">layouts/blog/list.rss.twig</code> (<code translate="no">blog</code> section only) to override them.</p>
<p>You can extend the built-in template and redefine only the <code translate="no">item</code> block, for example to publish an excerpt instead of the full content:</p>
<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> '_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>Set <a href="https://cecil.app/documentation/configuration/site/#baseurl"><code translate="no">baseurl</code></a> in <code translate="no">cecil.yml</code>: feeds use absolute URLs.</p>
<p>The RSS feed can also be styled in browsers by enabling the <code translate="no">xsl/rss</code> <a href="https://cecil.app/documentation/configuration/pages/#pages-default">default page</a>:</p>
<pre data-lang="yaml"><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="en">
    <id>https://cecil.app/how-to/templates-pagination/</id>
    <title>Paginate a list of pages</title>
    <published>2026-10-05T00:00:00+00:00</published>
    <updated>2026-10-16T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/templates-pagination/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>When a section contains many pages, Cecil can split its list into several pages (e.g. <code translate="no">/blog/</code>, <code translate="no">/blog/page/2/</code>, <code translate="no">/blog/page/3/</code>, etc.) and give you a <em>paginator</em> to build the navigation links.</p>
<h2 id="configure-pagination">Configure pagination<a class="heading-anchor" href="#configure-pagination" aria-hidden="true" tabindex="-1"></a></h2>
<p>Pagination is enabled by default for list pages (<em>homepage</em>, <em>section</em> and <em>term</em>), with 5 entries per page. Change it in <code translate="no">cecil.yml</code>:</p>
<pre data-lang="yaml"><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"># maximum number of entries per page</span>
    <span class="hljs-attr">path:</span> <span class="hljs-string">page</span> <span class="hljs-comment"># path of the paginated pages</span></code></pre>
<h2 id="override-it-for-a-section">Override it for a section<a class="heading-anchor" href="#override-it-for-a-section" aria-hidden="true" tabindex="-1"></a></h2>
<p>Set the <code translate="no">pagination</code> variable in the front matter of the section index file (e.g. <code translate="no">pages/blog/index.md</code>):</p>
<pre data-lang="yaml"><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>Or disable it for this section only:</p>
<pre data-lang="yaml"><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="display-the-paginated-pages">Display the paginated pages<a class="heading-anchor" href="#display-the-paginated-pages" aria-hidden="true" tabindex="-1"></a></h2>
<p>The paginator only exists when the list contains more pages than <code translate="no">max</code>. When pagination is disabled, or when all the pages fit on a single page, <code translate="no">page.paginator</code> is empty.</p>
<p>In the list template (e.g. <code translate="no">layouts/blog/list.html.twig</code>), loop over <code translate="no">page.paginator.pages</code> and fall back to <code translate="no">page.pages.showable</code> when there is no paginator:</p>
<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 page.paginator.pages ?? page.pages.showable %}</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="add-navigation-links">Add navigation links<a class="heading-anchor" href="#add-navigation-links" aria-hidden="true" tabindex="-1"></a></h2>
<p>Paginator links are page IDs, so use the <code translate="no">url()</code> function to create working links. The <code translate="no">{% if page.paginator %}</code> test hides the navigation when there is no paginator:</p>
<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">
<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>To list every page number, iterate from <code translate="no">1</code> to <code translate="no">page.paginator.count</code>:</p>
<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">
<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>See the documentation of the <a href="https://cecil.app/documentation/templates/variables/#page-paginator"><code translate="no">page.paginator</code> variable</a>, the <a href="https://cecil.app/documentation/configuration/pages/#pages-pagination">pagination configuration</a> and the <a href="https://cecil.app/documentation/content/pages/#pagination">section <code translate="no">pagination</code> variable</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/content-multilingual/</id>
    <title>Translate a site into multiple languages</title>
    <published>2026-10-04T00:00:00+00:00</published>
    <updated>2026-10-16T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/content-multilingual/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil handles multilingual sites natively: declare the languages, add translated pages, then link them together and translate your templates.</p>
<h2 id="declare-languages">Declare languages<a class="heading-anchor" href="#declare-languages" aria-hidden="true" tabindex="-1"></a></h2>
<p>Define the main language and the list of available languages in <code translate="no">cecil.yml</code>:</p>
<pre data-lang="yaml"><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>Options stored under the <code translate="no">config</code> key of a language override the global ones (here the site <code translate="no">title</code>).</p>
<h2 id="translate-a-page">Translate a page<a class="heading-anchor" href="#translate-a-page" aria-hidden="true" tabindex="-1"></a></h2>
<p>Duplicate the reference page and suffix its file name with the language code:</p>
<pre data-lang="plaintext"><code class="language-plaintext hljs plaintext" translate="no">pages/
├─ about.md    # the reference page
└─ about.fr.md # the French version</code></pre>
<p>Use the <code translate="no">slug</code> variable to translate the URL of the page:</p>
<pre data-lang="yaml"><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> is published to <code translate="no">/about/</code> and <code translate="no">about.fr.md</code> to <code translate="no">/fr/a-propos/</code>.</p>
<aside class="note note-tip"><p>To create a page that only exists in another language (not a translation), set <code translate="no">language: fr</code> in its front matter.</p></aside>
<h2 id="link-translated-pages">Link translated pages<a class="heading-anchor" href="#link-translated-pages" aria-hidden="true" tabindex="-1"></a></h2>
<p>Each page exposes its translations with <code translate="no">page.translations</code>. Add a language switcher to your template:</p>
<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 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>You can also include the built-in partial: <code translate="no">{{ include('partials/languages.html.twig') }}</code>.</p>
<aside class="note note-tip"><p>Translations are linked through the <code translate="no">langref</code> variable, which is derived from the file path by default. To link pages whose file paths differ, set the same <code translate="no">langref</code> in their front matter (e.g. <code translate="no">langref: about</code>).</p></aside>
<h2 id="translate-template-strings">Translate template strings<a class="heading-anchor" href="#translate-template-strings" aria-hidden="true" tabindex="-1"></a></h2>
<p>Wrap texts with the <code translate="no">trans</code> tag or filter:</p>
<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">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>Then add a translation file named after the language locale in the <code translate="no">translations</code> directory:</p>
<pre data-lang="yaml"><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>Extract the strings of your templates with:</p>
<pre data-lang="bash"><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>See the documentation of <a href="https://cecil.app/documentation/content/multilingual/">multilingual content</a>, <a href="https://cecil.app/documentation/configuration/languages/#languages">languages configuration</a> and <a href="https://cecil.app/documentation/templates/localization/">templates localization</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/templates-metatags/</id>
    <title>Apply SEO features in templates</title>
    <published>2026-06-09T00:00:00+00:00</published>
    <updated>2026-10-18T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/templates-metatags/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>Cecil exposes its SEO features through the <code translate="no">partials/metatags.html.twig</code> template. Include it in the <code translate="no">&lt;head&gt;</code> of your base template so every page automatically gets <strong>title, meta tags, canonical links, and social cards</strong>. Structured data (JSON-LD) can be enabled too, with the <code translate="no">metatags.data</code> option set to <code translate="no">true</code>.</p>
<pre data-lang="twig"><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>
<aside class="note note-important"><p>The partial already outputs the <code translate="no">&lt;title&gt;</code> element: do not add your own.</p></aside>
<p>The partial reads page front matter first, then falls back to site configuration when needed. See the <a href="https://cecil.app/documentation/configuration/site/#metatags">metatags configuration documentation</a> for all available options.</p>
<p>If you need to override the default title or image, pass values directly to the partial (<code translate="no">image</code> accepts a file path or an asset):</p>
<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/metatags.html.twig', {title: 'Custom title', image: 'images/social-card.png'})</span> }}</span></code></pre>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/markdown-performance-images/</id>
    <title>Optimize images in Markdown</title>
    <published>2025-06-01T00:00:00+00:00</published>
    <updated>2026-10-16T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/markdown-performance-images/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>One of the most effective ways to improve the performance of your website is to optimize images.</p>
<p>Cecil can automatically apply the following optimizations to images in Markdown (see the configuration below):</p>
<ol>
<li><strong>Dimensions</strong>: image dimensions are set to ensure proper layout and prevent layout shifts</li>
<li><strong>Compression</strong>: the image is compressed to reduce file size without significant loss of quality (requires <code translate="no">assets.images.optimize: true</code> and the optimization tools, such as JpegOptim or Optipng, installed)</li>
<li><strong>Image formats</strong>: Cecil generates AVIF and WebP formats for the image</li>
<li><strong>Responsive images</strong>: Cecil generates two different sizes of the image (based on the configuration) to serve the appropriate size for different devices</li>
<li><strong>Lazy loading</strong>: the image is set to load lazily, meaning it will only load when it comes into the viewport</li>
<li><strong>Decoding</strong>: the image is set to decode asynchronously, improving the initial page load time</li>
<li><strong>Placeholder</strong>: a color placeholder is used while the image is loading</li>
</ol>
<aside class="note note-info"><p>See the documentation for more details on the <a href="https://cecil.app/documentation/configuration/assets/#assets-images">global assets configuration</a> and the <a href="https://cecil.app/documentation/configuration/pages/#pages-body">pages configuration</a>.</p></aside>
<h2 id="example">Example<a class="heading-anchor" href="#example" aria-hidden="true" tabindex="-1"></a></h2>
<p>Below is an example with a 1920 × 1276 pixels JPEG image.</p>
<pre data-lang="markdown"><code class="language-markdown hljs markdown" translate="no">![<span class="hljs-string">A star forming region in the sky</span>](<span class="hljs-link">../../assets/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.jpg "Photo by Arnaud Girault"</span>){placeholder=color}</code></pre>
<figure>
<picture title="Photo by Arnaud Girault">
<source type="image/avif" srcset="https://cecil.app/thumbnails/480x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 480w, https://cecil.app/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 768w, https://cecil.app/thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 1024w, https://cecil.app/thumbnails/1536x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 1536w" width="1536" height="1021" sizes="100vw">
<source type="image/webp" srcset="https://cecil.app/thumbnails/480x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 480w, https://cecil.app/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 768w, https://cecil.app/thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 1024w, https://cecil.app/thumbnails/1536x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 1536w" width="1536" height="1021" sizes="100vw">
<img src="https://cecil.app/thumbnails/1536x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg" alt="A star forming region in the sky" loading="lazy" decoding="async" class="dark:brightness-90" width="1536" height="1021" style=";max-width:100%;height:auto;background-color:rgb(22 30 31);" srcset="https://cecil.app/thumbnails/480x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 480w, https://cecil.app/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 768w, https://cecil.app/thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 1024w, https://cecil.app/thumbnails/1536x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 1536w" sizes="100vw">
</picture>
<figcaption>Photo by <a href="https://unsplash.com/photos/a-star-forming-region-in-the-sky-IjEtFjxXweE" target="_blank" rel="noopener noreferrer">Arnaud Girault</a></figcaption>
</figure>
<h3 id="configuration">Configuration<a class="heading-anchor" href="#configuration" aria-hidden="true" tabindex="-1"></a></h3>
<pre data-lang="yaml"><code class="language-yaml hljs yaml" translate="no"><span class="hljs-comment"># global assets configuration</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 of images in 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="generated-html">Generated HTML<a class="heading-anchor" href="#generated-html" aria-hidden="true" tabindex="-1"></a></h3>
<pre data-lang="html"><code class="language-html hljs xml" translate="no"><span class="hljs-tag">&lt;<span class="hljs-name">picture</span> <span class="hljs-attr">title</span>=<span class="hljs-string">"Photo by Arnaud Girault"</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/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 768w,
            /thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 1024w"</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">sizes</span>=<span class="hljs-string">"100vw"</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/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 768w,
            /thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 1024w"</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">sizes</span>=<span class="hljs-string">"100vw"</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/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg"</span>
    <span class="hljs-attr">alt</span>=<span class="hljs-string">"A star forming region in the sky"</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(29 41 43);"</span>
    <span class="hljs-attr">srcset</span>=<span class="hljs-string">"/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 768w,
            /thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 1024w"</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="en">
    <id>https://cecil.app/how-to/templates-image-formats/</id>
    <title>Generate multiple formats of an image in templates</title>
    <published>2025-06-01T00:00:00+00:00</published>
    <updated>2026-10-16T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/templates-image-formats/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>For performance and bandwidth optimization, Cecil can generate multiple formats of an image, such as AVIF and WebP. This allows the browser to select the best format based on its capabilities:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset('image.jpg'), attributes={alt: 'Alternative description'}, options={formats: ['avif', 'webp']}) }}</span></code></pre>
<p>AVIF and WebP are image formats that offer better compression than JPEG and PNG at the same quality: images load faster and consume less data. Both are supported by all modern browsers (Chrome, Edge, Firefox, Safari and Opera); the original image is kept as a fallback for older ones.</p>
<aside class="note note-tip"><p>Alternative formats can be enabled for every image rendered with <code translate="no">html</code> through the <a href="https://cecil.app/documentation/configuration/layouts/#layouts-images"><code translate="no">layouts.images.formats</code> option</a>.</p></aside>
<h2 id="example">Example<a class="heading-anchor" href="#example" aria-hidden="true" tabindex="-1"></a></h2>
<p>Below is an example of how to generate AVIF and WebP formats of an image:</p>
<pre data-lang="twig"><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="generated-html">Generated HTML<a class="heading-anchor" href="#generated-html" aria-hidden="true" tabindex="-1"></a></h3>
<pre data-lang="html"><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">alt</span>=<span class="hljs-string">"Cecil logo"</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>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">picture</span>&gt;</span></code></pre>
<aside class="note note-info"><p>See the documentation of the <a href="https://cecil.app/documentation/templates/reference/functions/#html"><code translate="no">html</code> function</a>.</p></aside>]]>
    </content>
  </entry>
  <entry xml:lang="en">
    <id>https://cecil.app/how-to/templates-responsive-images/</id>
    <title>Render responsive images in templates</title>
    <published>2024-01-18T00:00:00+00:00</published>
    <updated>2026-10-16T00:00:00+00:00</updated>
    <link href="https://cecil.app/how-to/templates-responsive-images/" rel="alternate" type="text/html" />
    <content type="html">
      <![CDATA[<p>The easiest way to render <a href="https://developer.mozilla.org/docs/Web/HTML/Guides/Responsive_images" target="_blank" rel="noopener noreferrer">responsive images</a> in templates is with the <a href="https://cecil.app/documentation/templates/reference/functions/#html"><code translate="no">html</code> function</a>:</p>
<pre data-lang="twig"><code class="language-twig hljs twig" translate="no"><span class="hljs-template-variable">{{ html(asset('image.jpg'), attributes={alt: 'Alternative description'}, options={responsive: true}) }}</span></code></pre>
<aside class="note note-important"><p>The default width values of the generated images are 480, 640, 768, 1024, 1366, 1600 and 1920. They can be modified in the <em>assets</em> section of the <a href="https://cecil.app/documentation/configuration/assets/#assets-images">configuration</a>.</p></aside>
<aside class="note note-tip"><p>Responsive images can be enabled for every image rendered with <code translate="no">html</code> through the <a href="https://cecil.app/documentation/configuration/layouts/#layouts-images"><code translate="no">layouts.images.responsive</code> option</a>. Use <code translate="no">responsive: 'density'</code> to generate pixel density variants (<code translate="no">1x</code>, <code translate="no">2x</code>, etc.) instead of widths.</p></aside>
<h2 id="example">Example<a class="heading-anchor" href="#example" aria-hidden="true" tabindex="-1"></a></h2>
<p>Below is an example with a 1000×1000 pixel PNG image:</p>
<pre data-lang="twig"><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<a class="heading-anchor" href="#configuration" aria-hidden="true" tabindex="-1"></a></h3>
<pre data-lang="yaml"><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="generated-html">Generated HTML<a class="heading-anchor" href="#generated-html" aria-hidden="true" tabindex="-1"></a></h3>
<p>Reformatted for readability:</p>
<pre data-lang="html"><code class="language-html hljs xml" translate="no"><span class="hljs-tag">&lt;<span class="hljs-name">img</span>
  <span class="hljs-attr">src</span>=<span class="hljs-string">"/cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png"</span>
  <span class="hljs-attr">alt</span>=<span class="hljs-string">"Cecil logo"</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>
  <span class="hljs-attr">width</span>=<span class="hljs-string">"1000"</span>
  <span class="hljs-attr">height</span>=<span class="hljs-string">"1000"</span>
&gt;</span></code></pre>]]>
    </content>
  </entry>
</feed>
