{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "Cecil - How to?",
  "home_page_url": "https://cloudflare.cecil.app/how-to/",
  "feed_url": "https://cloudflare.cecil.app/how-to/feed.json",
  "description": "Articles and tutorials for common Cecil tasks.",
  "icon": "https://cloudflare.cecil.app/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "favicon": "https://cloudflare.cecil.app/thumbnails/64x/favicon.7ff4b89eec6dad139a7d2d6561543285.png",
  "language": "en",
  "items": [
    {
      "id": "https://cloudflare.cecil.app/how-to/extend-pages-generator/",
      "url": "https://cloudflare.cecil.app/how-to/extend-pages-generator/",
      "title": "Create a custom pages generator",
      "summary": "Create Cecil pages from an API, a database or any other source with a custom pages generator.",
      "date_published": "2026-10-22T00:00:00+00:00",
      "date_modified": "2026-10-26T00:00:00+00:00","content_text": "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.\nCreate the generator class\nAdd a PHP class in the extensions directory of your site, with your own namespace (e.g.: MySite\\Generator, the Cecil\\ namespace being reserved). It extends AbstractGenerator, implements GeneratorInterface, and adds pages to $this-&gt;generatedPages in the generate() method.\nThe new:extension command creates the skeleton of the class, and displays the configuration to enable it: php cecil.phar new:extension --type=generator --name=Posts --namespace=MySite.\nThe following example creates one page per item returned by a JSON API:\nextensions\/MySite\/Generator\/Posts.php\n&lt;?php\nnamespace MySite\\Generator;\n\nuse Cecil\\Collection\\Page\\Page;\nuse Cecil\\Collection\\Page\\Type;\nuse Cecil\\Generator\\AbstractGenerator;\nuse Cecil\\Generator\\GeneratorInterface;\n\nclass Posts extends AbstractGenerator implements GeneratorInterface\n{\n    public function generate(): void\n    {\n        $posts = json_decode(file_get_contents('https:\/\/jsonplaceholder.typicode.com\/posts'), true) ?? [];\n\n        foreach ($posts as $post) {\n            $page = (new Page(\"posts\/{$post['id']}\"))\n                -&gt;setType(Type::PAGE)\n                -&gt;setPath(\"posts\/{$post['id']}\")\n                -&gt;setSection('posts')\n                -&gt;setBodyHtml('&lt;p&gt;' . htmlspecialchars($post['body']) . '&lt;\/p&gt;')\n                -&gt;setVariable('title', $post['title']);\n            $this-&gt;generatedPages-&gt;add($page);\n        }\n    }\n}\nExisting pages (from Markdown files and previous generators) are available through $this-&gt;builder-&gt;getPages(), and the configuration through $this-&gt;config.\nRegister the generator\nAdd the class name to the pages.generators map in cecil.yml, indexed by a name, with its priority:\npages:\n  generators:\n    Posts: { class: MySite\\Generator\\Posts, priority: 35 }\nGenerators run in ascending priority order. The built-in ones use priorities from 10 (DefaultPages) to 90 (Redirect): with 35, the generated pages are created before sections (40), so thanks to setSection() they are grouped in the posts section like pages from Markdown files.\nWithout setSection(), pages created by a generator don’t belong to any section. Like any other page, they are listed in site.pages.showable and in the sitemap: set the excluded variable to true to keep a page out of lists.\nBuild\nphp cecil.phar build\nThe pages are now available at \/posts\/1\/, \/posts\/2\/, etc., rendered with the default page templates.\nSee the pages generator documentation for another example, using a SQLite database.",
      "content_html": "<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>\n<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>\n<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>\n<aside class=\"note note-tip\"><p>The <a href=\"https://cloudflare.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>\n<p>The following example creates one page per item returned by a JSON API:</p>\n<p><em>extensions/MySite/Generator/Posts.php</em></p>\n<pre data-lang=\"php\"><code class=\"language-php hljs php\" translate=\"no\"><span class=\"hljs-meta\">&lt;?php</span>\n<span class=\"hljs-keyword\">namespace</span> <span class=\"hljs-title\">MySite</span>\\<span class=\"hljs-title\">Generator</span>;\n\n<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>;\n<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>;\n<span class=\"hljs-keyword\">use</span> <span class=\"hljs-title\">Cecil</span>\\<span class=\"hljs-title\">Generator</span>\\<span class=\"hljs-title\">AbstractGenerator</span>;\n<span class=\"hljs-keyword\">use</span> <span class=\"hljs-title\">Cecil</span>\\<span class=\"hljs-title\">Generator</span>\\<span class=\"hljs-title\">GeneratorInterface</span>;\n\n<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>\n</span>{\n    <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>\n    </span>{\n        $posts = json_decode(file_get_contents(<span class=\"hljs-string\">'https://jsonplaceholder.typicode.com/posts'</span>), <span class=\"hljs-keyword\">true</span>) ?? [];\n\n        <span class=\"hljs-keyword\">foreach</span> ($posts <span class=\"hljs-keyword\">as</span> $post) {\n            $page = (<span class=\"hljs-keyword\">new</span> Page(<span class=\"hljs-string\">\"posts/{$post['id']}\"</span>))\n                -&gt;setType(Type::PAGE)\n                -&gt;setPath(<span class=\"hljs-string\">\"posts/{$post['id']}\"</span>)\n                -&gt;setSection(<span class=\"hljs-string\">'posts'</span>)\n                -&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>)\n                -&gt;setVariable(<span class=\"hljs-string\">'title'</span>, $post[<span class=\"hljs-string\">'title'</span>]);\n            <span class=\"hljs-keyword\">$this</span>-&gt;generatedPages-&gt;add($page);\n        }\n    }\n}</code></pre>\n<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>\n<h2 id=\"register-the-generator\">Register the generator<a class=\"heading-anchor\" href=\"#register-the-generator\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Add the class name to the <a href=\"https://cloudflare.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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">generators:</span>\n    <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>\n<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>\n<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>\n<h2 id=\"build\">Build<a class=\"heading-anchor\" href=\"#build\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar build</code></pre>\n<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>\n<aside class=\"note note-info\"><p>See the <a href=\"https://cloudflare.cecil.app/documentation/developers/extend/#page-generators\">pages generator documentation</a> for another example, using a SQLite database.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/extend-twig-extension/",
      "url": "https://cloudflare.cecil.app/how-to/extend-twig-extension/",
      "title": "Add a custom Twig function or filter",
      "summary": "Extend Cecil templates with your own Twig functions and filters through a Twig extension.",
      "date_published": "2026-10-21T00:00:00+00:00",
      "date_modified": "2026-10-26T00:00:00+00:00","content_text": "Cecil provides many template functions and filters, but you can add your own with a Twig extension written in PHP.\nCreate the extension class\nAdd a PHP file in the extensions directory of your site, with your own namespace (e.g.: MySite\\Twig, the Cecil\\ namespace being reserved), the file path matching the namespace:\nextensions\/MySite\/Twig\/MyTwigExtension.php\n&lt;?php\nnamespace MySite\\Twig;\n\nclass MyTwigExtension extends \\Twig\\Extension\\AbstractExtension\n{\n    public function getFilters(): array\n    {\n        return [\n            \/\/ {{ 'text'|md5 }}\n            new \\Twig\\TwigFilter('md5', 'md5'),\n            \/\/ {{ page.content|word_count }}\n            new \\Twig\\TwigFilter('word_count', [$this, 'wordCount']),\n        ];\n    }\n\n    public function getFunctions(): array\n    {\n        return [\n            \/\/ {{ year() }}\n            new \\Twig\\TwigFunction('year', fn () =&gt; date('Y')),\n        ];\n    }\n\n    public function wordCount(string $html): int\n    {\n        return str_word_count(strip_tags($html));\n    }\n}\nThe new:extension command creates the skeleton of the class: php cecil.phar new:extension --type=twig --name=MyTwigExtension --namespace=MySite.\nRegister the extension\nAdd the class name to the layouts.extensions map in cecil.yml, indexed by a name of your choice:\nlayouts:\n  extensions:\n    MyExtension: MySite\\Twig\\MyTwigExtension\nUse it in templates\n&lt;p&gt;{{ page.content|word_count }} words&lt;\/p&gt;\n&lt;footer&gt;© {{ year() }} {{ site.title }}&lt;\/footer&gt;\nRun the build with the -vvv option to check that the extension is loaded: Cecil logs Extension \"MyExtension\" (layouts.extensions) loaded, or an error if the class can’t be loaded. See the Twig extension documentation.",
      "content_html": "<p>Cecil provides many template <a href=\"https://cloudflare.cecil.app/documentation/templates/reference/functions/\">functions</a> and <a href=\"https://cloudflare.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>\n<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>\n<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>\n<p><em>extensions/MySite/Twig/MyTwigExtension.php</em></p>\n<pre data-lang=\"php\"><code class=\"language-php hljs php\" translate=\"no\"><span class=\"hljs-meta\">&lt;?php</span>\n<span class=\"hljs-keyword\">namespace</span> <span class=\"hljs-title\">MySite</span>\\<span class=\"hljs-title\">Twig</span>;\n\n<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>\n</span>{\n    <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>\n    </span>{\n        <span class=\"hljs-keyword\">return</span> [\n            <span class=\"hljs-comment\">// {{ 'text'|md5 }}</span>\n            <span class=\"hljs-keyword\">new</span> \\Twig\\TwigFilter(<span class=\"hljs-string\">'md5'</span>, <span class=\"hljs-string\">'md5'</span>),\n            <span class=\"hljs-comment\">// {{ page.content|word_count }}</span>\n            <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>]),\n        ];\n    }\n\n    <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>\n    </span>{\n        <span class=\"hljs-keyword\">return</span> [\n            <span class=\"hljs-comment\">// {{ year() }}</span>\n            <span class=\"hljs-keyword\">new</span> \\Twig\\TwigFunction(<span class=\"hljs-string\">'year'</span>, fn () =&gt; date(<span class=\"hljs-string\">'Y'</span>)),\n        ];\n    }\n\n    <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>\n    </span>{\n        <span class=\"hljs-keyword\">return</span> str_word_count(strip_tags($html));\n    }\n}</code></pre>\n<aside class=\"note note-tip\"><p>The <a href=\"https://cloudflare.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>\n<h2 id=\"register-the-extension\">Register the extension<a class=\"heading-anchor\" href=\"#register-the-extension\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">layouts:</span>\n  <span class=\"hljs-attr\">extensions:</span>\n    <span class=\"hljs-attr\">MyExtension:</span> <span class=\"hljs-string\">MySite\\Twig\\MyTwigExtension</span></code></pre>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">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>\n<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>\n<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://cloudflare.cecil.app/documentation/developers/extend/#twig-extension\">Twig extension documentation</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/templates-fragments-cache/",
      "url": "https://cloudflare.cecil.app/how-to/templates-fragments-cache/",
      "title": "Speed up builds with fragments cache",
      "summary": "Cache parts of Cecil templates to avoid rendering the same content for every page.",
      "date_published": "2026-10-20T00:00:00+00:00","content_text": "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 fragments cache, Cecil renders such a part once per build and language, then reuses the result for the other pages.\nWrap content with the cache tag\nSurround the cacheable part of a template with the cache tag and a key built with the cache_key function:\n{% cache cache_key('footer') %}\n  &lt;footer&gt;\n    {% for entry in site.menus.footer|sort_by_weight %}\n      &lt;a href=\"{{ url(entry.url) }}\"&gt;{{ entry.name }}&lt;\/a&gt;\n    {% endfor %}\n  &lt;\/footer&gt;\n{% endcache %}\nBuild the cache key\nThe cache_key function builds a key from a name, an optional value, the current language and the build ID:\n{% cache cache_key('sidebar', page.section) %}\n  {# cacheable content #}\n{% endcache %}\n\nthe language ensures that each language gets its own fragment\nthe build ID changes on every build, so a fragment is rendered once per build and never reused by a later build\nthe 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\n\nFragments cache is stored on disk and has no expiration. With a fixed key such as {% cache 'footer' %}, 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 cache_key.\nExample: latest posts sidebar\nThe list below is rendered once per build and language, then reused by every page that includes it:\n{% cache cache_key('latest-posts') %}\n  &lt;aside&gt;\n    &lt;h2&gt;Latest posts&lt;\/h2&gt;\n    &lt;ul&gt;\n    {% for post in site.pages.showable|filter_by('section', 'blog')|sort_by_date|slice(0, 5) %}\n      &lt;li&gt;&lt;a href=\"{{ url(post) }}\"&gt;{{ post.title }}&lt;\/a&gt;&lt;\/li&gt;\n    {% endfor %}\n    &lt;\/ul&gt;\n  &lt;\/aside&gt;\n{% endcache %}\nDo not cache content that depends on the current page (e.g. active menu item, page title), or include a page value (like page.id) in the key.\nClear the cache\nClear only the fragments cache:\nphp cecil.phar cache:clear:templates --fragments\nOr clear the whole templates cache, or all caches:\nphp cecil.phar cache:clear:templates\nphp cecil.phar cache:clear\nDuring local development, you can also clear the cache before each build:\nphp cecil.phar serve --clear-cache\nSee the documentation of fragments cache, the cache_key function and the cache configuration.",
      "content_html": "<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>\n<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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">cache</span> cache_key('footer') %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">footer</span>&gt;</span>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> entry in site.menus.footer|sort_by_weight %}</span><span class=\"xml\">\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(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>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">footer</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endcache</span> %}</span></code></pre>\n<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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">cache</span> cache_key('sidebar', page.section) %}</span><span class=\"xml\">\n  </span><span class=\"hljs-comment\">{# cacheable content #}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endcache</span> %}</span></code></pre>\n<ul>\n<li>the language ensures that each language gets its own fragment</li>\n<li>the build ID changes on every build, so a fragment is rendered once per build and never reused by a later build</li>\n<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>\n</ul>\n<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>\n<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>\n<p>The list below is rendered once per build and language, then reused by every page that includes it:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">cache</span> cache_key('latest-posts') %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">aside</span>&gt;</span>\n    <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>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ul</span>&gt;</span>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> post in site.pages.showable|filter_by('section', 'blog')|sort_by_date|<span class=\"hljs-keyword\">slice</span>(0, 5) %}</span><span class=\"xml\">\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(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>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">ul</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">aside</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endcache</span> %}</span></code></pre>\n<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>\n<h2 id=\"clear-the-cache\">Clear the cache<a class=\"heading-anchor\" href=\"#clear-the-cache\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Clear only the fragments cache:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar cache:clear:templates --fragments</code></pre>\n<p>Or clear the whole templates cache, or all caches:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar cache:clear:templates\nphp cecil.phar cache:clear</code></pre>\n<p>During local development, you can also clear the cache before each build:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar serve --clear-cache</code></pre>\n<aside class=\"note note-info\"><p>See the documentation of <a href=\"https://cloudflare.cecil.app/documentation/templates/cache/#fragments-cache\">fragments cache</a>, the <a href=\"https://cloudflare.cecil.app/documentation/templates/reference/functions/#cache-key\"><code translate=\"no\">cache_key</code> function</a> and the <a href=\"https://cloudflare.cecil.app/documentation/configuration/cache/\">cache configuration</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/content-data-files/",
      "url": "https://cloudflare.cecil.app/how-to/content-data-files/",
      "title": "Generate pages from data files",
      "summary": "Use YAML, JSON, CSV or XML data files to build Cecil pages without writing Markdown for each item.",
      "date_published": "2026-10-19T00:00:00+00:00",
      "date_modified": "2026-10-26T00:00:00+00:00","content_text": "Data files are a convenient way to manage structured content (team members, products, events, etc.) outside of pages, then display it with templates.\nAdd a data file\nStore your files in the data directory. Supported formats are YAML, JSON, XML and CSV.\n# data\/team.yml\n- name: Ada\n  role: Developer\n- name: Grace\n  role: Designer\nA localized version can be added with a language suffix (e.g. data\/team.fr.yml): it is used for the pages in that language.\nAs soon as a language has at least one localized data file, site.data only contains the localized files for that language: non-localized files are no longer available to its pages.\nDisplay data in a template\nThe file is available in templates with site.data.&lt;filename&gt;, e.g. layouts\/team.html.twig:\n{% extends 'page.html.twig' %}\n\n{% block content %}\n  &lt;h1&gt;{{ page.title }}&lt;\/h1&gt;\n  &lt;ul&gt;\n  {% for member in site.data.team %}\n    &lt;li&gt;{{ member.name }}, {{ member.role }}&lt;\/li&gt;\n  {% endfor %}\n  &lt;\/ul&gt;\n{% endblock %}\nFiles in sub-directories are nested: data\/galleries\/gallery-1.json is available with site.data.galleries['gallery-1'].\nCreate the page\nThe page that uses this template doesn’t need any content, so declare it as a default page in cecil.yml, indexed by ID:\npages:\n  default:\n    team:\n      path: team\n      title: Our team\n      layout: team\nYou can also create a pages\/team.md file with layout: team in its front matter.\nGenerate one page per item\nTo generate a page per entry, create a pages generator. Data loaded from data files is available with $this-&gt;builder-&gt;getData():\n&lt;?php\n\/\/ extensions\/MySite\/Generator\/Team.php\nnamespace MySite\\Generator;\n\nuse Cecil\\Collection\\Page\\Page;\nuse Cecil\\Collection\\Page\\Type;\nuse Cecil\\Generator\\AbstractGenerator;\nuse Cecil\\Generator\\GeneratorInterface;\nuse Cecil\\Util\\Slugifier;\n\nclass Team extends AbstractGenerator implements GeneratorInterface\n{\n    public function generate(): void\n    {\n        $data = $this-&gt;builder-&gt;getData($this-&gt;config-&gt;getLanguageDefault());\n        foreach ($data['team'] ?? [] as $member) {\n            $slug = Slugifier::slugify($member['name']);\n            $page = (new Page(\"team\/$slug\"))\n                -&gt;setType(Type::PAGE)\n                -&gt;setPath(\"team\/$slug\")\n                -&gt;setSection('team')\n                -&gt;setBodyHtml('&lt;p&gt;' . htmlspecialchars($member['role']) . '&lt;\/p&gt;')\n                -&gt;setVariable('title', $member['name']);\n            $this-&gt;generatedPages-&gt;add($page);\n        }\n    }\n}\nThen register it:\npages:\n  generators:\n    Team: { class: MySite\\Generator\\Team, priority: 25 }\nPages created by a generator don’t belong to any section: setSection() is required to group them in the team section. Like any other page, they are listed in site.pages.showable and in the sitemap: set the excluded variable to true to keep a page out of lists.\nSee the documentation of data configuration, the site.data variable and pages generators.",
      "content_html": "<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>\n<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>\n<p>Store your files in the <code translate=\"no\">data</code> directory. Supported formats are YAML, JSON, XML and CSV.</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-comment\"># data/team.yml</span>\n<span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">Ada</span>\n  <span class=\"hljs-attr\">role:</span> <span class=\"hljs-string\">Developer</span>\n<span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">Grace</span>\n  <span class=\"hljs-attr\">role:</span> <span class=\"hljs-string\">Designer</span></code></pre>\n<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>\n<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>\n<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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">extends</span></span> 'page.html.twig' %}</span><span class=\"xml\">\n\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">block</span></span> content %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ page.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">h1</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ul</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> member in site.data.team %}</span><span class=\"xml\">\n    <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>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">ul</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endblock</span></span> %}</span></code></pre>\n<p>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>\n<h2 id=\"create-the-page\">Create the page<a class=\"heading-anchor\" href=\"#create-the-page\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The page that uses this template doesn’t need any content, so declare it as a <a href=\"https://cloudflare.cecil.app/documentation/configuration/pages/#pages-default\">default page</a> in <code translate=\"no\">cecil.yml</code>, indexed by ID:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">default:</span>\n    <span class=\"hljs-attr\">team:</span>\n      <span class=\"hljs-attr\">path:</span> <span class=\"hljs-string\">team</span>\n      <span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Our</span> <span class=\"hljs-string\">team</span>\n      <span class=\"hljs-attr\">layout:</span> <span class=\"hljs-string\">team</span></code></pre>\n<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>\n<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>\n<p>To generate a page per entry, create a <a href=\"https://cloudflare.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>\n<pre data-lang=\"php\"><code class=\"language-php hljs php\" translate=\"no\"><span class=\"hljs-meta\">&lt;?php</span>\n<span class=\"hljs-comment\">// extensions/MySite/Generator/Team.php</span>\n<span class=\"hljs-keyword\">namespace</span> <span class=\"hljs-title\">MySite</span>\\<span class=\"hljs-title\">Generator</span>;\n\n<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>;\n<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>;\n<span class=\"hljs-keyword\">use</span> <span class=\"hljs-title\">Cecil</span>\\<span class=\"hljs-title\">Generator</span>\\<span class=\"hljs-title\">AbstractGenerator</span>;\n<span class=\"hljs-keyword\">use</span> <span class=\"hljs-title\">Cecil</span>\\<span class=\"hljs-title\">Generator</span>\\<span class=\"hljs-title\">GeneratorInterface</span>;\n<span class=\"hljs-keyword\">use</span> <span class=\"hljs-title\">Cecil</span>\\<span class=\"hljs-title\">Util</span>\\<span class=\"hljs-title\">Slugifier</span>;\n\n<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>\n</span>{\n    <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>\n    </span>{\n        $data = <span class=\"hljs-keyword\">$this</span>-&gt;builder-&gt;getData(<span class=\"hljs-keyword\">$this</span>-&gt;config-&gt;getLanguageDefault());\n        <span class=\"hljs-keyword\">foreach</span> ($data[<span class=\"hljs-string\">'team'</span>] ?? [] <span class=\"hljs-keyword\">as</span> $member) {\n            $slug = Slugifier::slugify($member[<span class=\"hljs-string\">'name'</span>]);\n            $page = (<span class=\"hljs-keyword\">new</span> Page(<span class=\"hljs-string\">\"team/$slug\"</span>))\n                -&gt;setType(Type::PAGE)\n                -&gt;setPath(<span class=\"hljs-string\">\"team/$slug\"</span>)\n                -&gt;setSection(<span class=\"hljs-string\">'team'</span>)\n                -&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>)\n                -&gt;setVariable(<span class=\"hljs-string\">'title'</span>, $member[<span class=\"hljs-string\">'name'</span>]);\n            <span class=\"hljs-keyword\">$this</span>-&gt;generatedPages-&gt;add($page);\n        }\n    }\n}</code></pre>\n<p>Then register it:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">generators:</span>\n    <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>\n<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>\n<aside class=\"note note-info\"><p>See the documentation of <a href=\"https://cloudflare.cecil.app/documentation/configuration/data-static/#data\">data configuration</a>, the <a href=\"https://cloudflare.cecil.app/documentation/templates/variables/#site-data\"><code translate=\"no\">site.data</code> variable</a> and <a href=\"https://cloudflare.cecil.app/documentation/developers/extend/#page-generators\">pages generators</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/templates-components/",
      "url": "https://cloudflare.cecil.app/how-to/templates-components/",
      "title": "Use Twig components",
      "summary": "Create reusable template units with Cecil components and the x tag.",
      "date_published": "2026-10-18T00:00:00+00:00","content_text": "Components are small reusable Twig templates (button, card, alert, etc.) called with a dedicated tag: they accept attributes and can wrap any content.\nCreate a component\nComponents are Twig templates stored in the components\/ subdirectory of your layouts directory. Create layouts\/components\/button.twig:\n&lt;button {{ attributes.merge({class: 'rounded px-4'}) }}&gt;\n  {{ slot }}\n&lt;\/button&gt;\n\nslot contains the content added between the opening and the closing tags\nattributes contains the attributes passed to the component, and merge() combines them with default values\n\nUse the component\nCall the component with the x tag followed by : and the file name of the component, without extension:\n{% x:button with {class: 'text-white'} %}\n  &lt;strong&gt;Click me&lt;\/strong&gt;\n{% endx %}\nIt will render:\n&lt;button class=\"text-white rounded px-4\"&gt;\n  &lt;strong&gt;Click me&lt;\/strong&gt;\n&lt;\/button&gt;\nPass variables\nValues passed with with are also available as variables inside the component. For example, layouts\/components\/card.twig:\n&lt;article class=\"card\"&gt;\n  &lt;h2&gt;&lt;a href=\"{{ href }}\"&gt;{{ title }}&lt;\/a&gt;&lt;\/h2&gt;\n  {{ slot }}\n&lt;\/article&gt;\nUse it in a list template:\n{% for p in page.pages.showable %}\n  {% x:card with {href: url(p), title: p.title} %}\n    &lt;p&gt;{{ p.description }}&lt;\/p&gt;\n  {% endx %}\n{% endfor %}\nChange the components directory\nThe directory and file extension of components can be changed in cecil.yml:\nlayouts:\n  components:\n    dir: components # components source directory\n    ext: twig       # components files extension\nSee the documentation of components and the components configuration. The feature is provided by the Twig components extension.",
      "content_html": "<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>\n<h2 id=\"create-a-component\">Create a component<a class=\"heading-anchor\" href=\"#create-a-component\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button</span> </span></span><span class=\"hljs-template-variable\">{{ attributes.merge({class: 'rounded px-4'}) }}</span><span class=\"xml\"><span class=\"hljs-tag\">&gt;</span>\n  </span><span class=\"hljs-template-variable\">{{ slot }}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">button</span>&gt;</span></span></code></pre>\n<ul>\n<li><code translate=\"no\">slot</code> contains the content added between the opening and the closing tags</li>\n<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>\n</ul>\n<h2 id=\"use-the-component\">Use the component<a class=\"heading-anchor\" href=\"#use-the-component\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<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\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">strong</span>&gt;</span>Click me<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">strong</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endx</span> %}</span></code></pre>\n<p>It will render:</p>\n<pre data-lang=\"html\"><code class=\"language-html hljs xml\" translate=\"no\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">button</span> <span class=\"hljs-attr\">class</span>=<span class=\"hljs-string\">\"text-white rounded px-4\"</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">strong</span>&gt;</span>Click me<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">strong</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">button</span>&gt;</span></code></pre>\n<h2 id=\"pass-variables\">Pass variables<a class=\"heading-anchor\" href=\"#pass-variables\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">article</span> <span class=\"hljs-attr\">class</span>=<span class=\"hljs-string\">\"card\"</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h2</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ 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>\n  </span><span class=\"hljs-template-variable\">{{ slot }}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">article</span>&gt;</span></span></code></pre>\n<p>Use it in a list template:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> p in page.pages.showable %}</span><span class=\"xml\">\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">x</span>:card with {href: url(p), title: p.title} %}</span><span class=\"xml\">\n    <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>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endx</span> %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre>\n<h2 id=\"change-the-components-directory\">Change the components directory<a class=\"heading-anchor\" href=\"#change-the-components-directory\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The directory and file extension of components can be changed in <code translate=\"no\">cecil.yml</code>:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">layouts:</span>\n  <span class=\"hljs-attr\">components:</span>\n    <span class=\"hljs-attr\">dir:</span> <span class=\"hljs-string\">components</span> <span class=\"hljs-comment\"># components source directory</span>\n    <span class=\"hljs-attr\">ext:</span> <span class=\"hljs-string\">twig</span>       <span class=\"hljs-comment\"># components files extension</span></code></pre>\n<aside class=\"note note-info\"><p>See the documentation of <a href=\"https://cloudflare.cecil.app/documentation/templates/components/\">components</a> and the <a href=\"https://cloudflare.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>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/content-schedule/",
      "url": "https://cloudflare.cecil.app/how-to/content-schedule/",
      "title": "Schedule the publication of a page",
      "summary": "Publish or unpublish a Cecil page at a given date with the schedule front matter variable.",
      "date_published": "2026-10-17T00:00:00+00:00",
      "date_modified": "2026-10-18T00:00:00+00:00","content_text": "With the schedule variable, a page can be written in advance and published later, or removed from the site after a given date.\nPublish a page at a date\nThe page is published only if the build date is on or after the publish date:\n---\ntitle: Product launch\nschedule:\n  publish: 2026-11-15\n---\nUnpublish a page after a date\nThe page is published only if the build date is before the expiry date. As a date without time means midnight, the page is already unpublished on the expiry day itself (add a time, e.g. 2026-08-31 23:59:59, to keep it during that day):\n---\ntitle: Summer sale\nschedule:\n  expiry: 2026-08-31\n---\nPublish a page between two dates\nCombine both dates: the page is published only if the publish date is reached and the expiry date is not passed:\n---\ntitle: Black Friday\nschedule:\n  publish: 2026-11-27\n  expiry: 2026-12-01\n---\nRebuild the site regularly\nA static site doesn’t change by itself: the schedule is evaluated at build time. A page planned for November 15 will appear only after a build that runs on or after that date.\nTo make it automatic, rebuild the site every day. For example, with GitHub Pages, add a schedule trigger to the on section of your workflow:\n# .github\/workflows\/build-and-deploy.yml\non:\n  push:\n    branches: [master, main]\n  schedule:\n    - cron: '0 6 * * *' # every day at 6:00 UTC\n  workflow_dispatch:\nOn public repositories, GitHub disables scheduled workflows after 60 days without activity in the repository.\nMost Jamstack platforms provide a similar feature (scheduled builds or build hooks triggered by a cron job).\nTo check the result locally, run php cecil.phar build --show-pages and look for your page in the list of built pages.\nSee the documentation of the schedule variable and of continuous deployment.",
      "content_html": "<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>\n<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>\n<p>The page is published only if the build date is on or after the <code translate=\"no\">publish</code> date:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Product</span> <span class=\"hljs-string\">launch</span>\n<span class=\"hljs-attr\">schedule:</span>\n  <span class=\"hljs-attr\">publish:</span> <span class=\"hljs-number\">2026</span><span class=\"hljs-number\">-11</span><span class=\"hljs-number\">-15</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<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>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Summer</span> <span class=\"hljs-string\">sale</span>\n<span class=\"hljs-attr\">schedule:</span>\n  <span class=\"hljs-attr\">expiry:</span> <span class=\"hljs-number\">2026</span><span class=\"hljs-number\">-08</span><span class=\"hljs-number\">-31</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<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>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Black</span> <span class=\"hljs-string\">Friday</span>\n<span class=\"hljs-attr\">schedule:</span>\n  <span class=\"hljs-attr\">publish:</span> <span class=\"hljs-number\">2026</span><span class=\"hljs-number\">-11</span><span class=\"hljs-number\">-27</span>\n  <span class=\"hljs-attr\">expiry:</span> <span class=\"hljs-number\">2026</span><span class=\"hljs-number\">-12</span><span class=\"hljs-number\">-01</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<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>\n<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>\n<p>To make it automatic, rebuild the site every day. For example, with <a href=\"https://cloudflare.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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-comment\"># .github/workflows/build-and-deploy.yml</span>\n<span class=\"hljs-attr\">on:</span>\n  <span class=\"hljs-attr\">push:</span>\n    <span class=\"hljs-attr\">branches:</span> <span class=\"hljs-string\">[master,</span> <span class=\"hljs-string\">main]</span>\n  <span class=\"hljs-attr\">schedule:</span>\n    <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>\n  <span class=\"hljs-attr\">workflow_dispatch:</span></code></pre>\n<p>On public repositories, GitHub disables scheduled workflows after 60 days without activity in the repository.</p>\n<p>Most Jamstack platforms provide a similar feature (scheduled builds or build hooks triggered by a cron job).</p>\n<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>\n<aside class=\"note note-info\"><p>See the documentation of the <a href=\"https://cloudflare.cecil.app/documentation/content/front-matter/#schedule\"><code translate=\"no\">schedule</code> variable</a> and of <a href=\"https://cloudflare.cecil.app/documentation/deploy/continuous-deployment/#github-pages\">continuous deployment</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/output-sitemap-robots/",
      "url": "https://cloudflare.cecil.app/how-to/output-sitemap-robots/",
      "title": "Customize sitemap and robots.txt",
      "summary": "Control the XML sitemap and robots.txt files generated by Cecil, exclude pages and override templates.",
      "date_published": "2026-10-16T00:00:00+00:00",
      "date_modified": "2026-10-20T00:00:00+00:00","content_text": "Cecil automatically generates \/sitemap.xml and \/robots.txt: they are default pages rendered with the built-in templates _default\/sitemap.xml.twig and _default\/robots.txt.twig.\nHow it works\nThe two pages are declared in the default configuration:\npages:\n  default:\n    robots:\n      path: robots\n      layout: robots\n      output: txt\n    sitemap:\n      path: sitemap\n      layout: sitemap\n      output: xml\n      changefreq: monthly\n      priority: 0.5\n\nthe sitemap lists all showable pages (published, not paginated, not redirected, not excluded), including sections and taxonomies, with their translations;\nrobots.txt allows everything, disallows redirect pages and the 404 page, and points to the sitemap.\n\nSet baseurl in cecil.yml: both files use absolute URLs.\nExclude a page from the sitemap\nAdd excluded to the page front matter:\n---\ntitle: Thank you\nexcluded: true\n---\nThe page is still published, but hidden from the sitemap and from list pages (home page, sections, etc.). Use published: false to not publish it at all.\nChange the default frequency and priority\npages:\n  default:\n    sitemap:\n      changefreq: weekly\n      priority: 0.8\nYou can also set them per page, in the front matter:\n---\ntitle: News\nsitemap:\n  changefreq: daily\n  priority: 0.9\n---\nPages with a custom canonical URL (canonical.url in the front matter) are not listed in the sitemap.\nAdd rules to robots.txt\nCreate a pages\/robots.md page: its body is appended to the generated rules. As it replaces the default robots page, set excluded: true to keep it out of the sitemap and list pages.\n---\nlayout: robots\nexcluded: true\noutput: txt\n---\nUser-agent: GPTBot\nDisallow: \/\nOverride the templates\nExtract the built-in templates to start from the originals:\nphp cecil.phar util:templates:extract\nOr create layouts\/sitemap.xml.twig (or layouts\/robots.txt.twig) from scratch. For example, a sitemap that also skips pages with a custom sitemap_exclude front matter variable:\n&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;urlset xmlns=\"http:\/\/www.sitemaps.org\/schemas\/sitemap\/0.9\"&gt;\n  {%- for p in site.pages.showable|filter(p =&gt; not p.sitemap_exclude|default(false))|sort_by_date ~%}\n  &lt;url&gt;\n    &lt;loc&gt;{{ url(p, {canonical: true}) }}&lt;\/loc&gt;\n    &lt;lastmod&gt;{{ p.date|date('Y-m-d') }}&lt;\/lastmod&gt;\n  &lt;\/url&gt;\n  {%- endfor ~%}\n&lt;\/urlset&gt;\nTo disable one of these files, unpublish its default page:\npages:\n  default:\n    sitemap:\n      published: false",
      "content_html": "<p>Cecil automatically generates <code translate=\"no\">/sitemap.xml</code> and <code translate=\"no\">/robots.txt</code>: they are <a href=\"https://cloudflare.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>\n<h2 id=\"how-it-works\">How it works<a class=\"heading-anchor\" href=\"#how-it-works\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The two pages are declared in the default configuration:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">default:</span>\n    <span class=\"hljs-attr\">robots:</span>\n      <span class=\"hljs-attr\">path:</span> <span class=\"hljs-string\">robots</span>\n      <span class=\"hljs-attr\">layout:</span> <span class=\"hljs-string\">robots</span>\n      <span class=\"hljs-attr\">output:</span> <span class=\"hljs-string\">txt</span>\n    <span class=\"hljs-attr\">sitemap:</span>\n      <span class=\"hljs-attr\">path:</span> <span class=\"hljs-string\">sitemap</span>\n      <span class=\"hljs-attr\">layout:</span> <span class=\"hljs-string\">sitemap</span>\n      <span class=\"hljs-attr\">output:</span> <span class=\"hljs-string\">xml</span>\n      <span class=\"hljs-attr\">changefreq:</span> <span class=\"hljs-string\">monthly</span>\n      <span class=\"hljs-attr\">priority:</span> <span class=\"hljs-number\">0.5</span></code></pre>\n<ul>\n<li>the <strong>sitemap</strong> lists all showable pages (published, not paginated, not redirected, not excluded), including sections and taxonomies, with their translations;</li>\n<li><strong>robots.txt</strong> allows everything, disallows redirect pages and the 404 page, and points to the sitemap.</li>\n</ul>\n<aside class=\"note note-important\"><p>Set <a href=\"https://cloudflare.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>\n<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>\n<p>Add <a href=\"https://cloudflare.cecil.app/documentation/content/front-matter/#excluded\"><code translate=\"no\">excluded</code></a> to the page front matter:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Thank</span> <span class=\"hljs-string\">you</span>\n<span class=\"hljs-attr\">excluded:</span> <span class=\"hljs-literal\">true</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<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>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">default:</span>\n    <span class=\"hljs-attr\">sitemap:</span>\n      <span class=\"hljs-attr\">changefreq:</span> <span class=\"hljs-string\">weekly</span>\n      <span class=\"hljs-attr\">priority:</span> <span class=\"hljs-number\">0.8</span></code></pre>\n<p>You can also set them per page, in the front matter:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">News</span>\n<span class=\"hljs-attr\">sitemap:</span>\n  <span class=\"hljs-attr\">changefreq:</span> <span class=\"hljs-string\">daily</span>\n  <span class=\"hljs-attr\">priority:</span> <span class=\"hljs-number\">0.9</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<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>\n<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>\n<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>\n<pre data-lang=\"markdown\"><code class=\"language-markdown hljs markdown\" translate=\"no\">---\nlayout: robots\nexcluded: true\n<span class=\"hljs-section\">output: txt\n---</span>\nUser-agent: GPTBot\nDisallow: /</code></pre>\n<h2 id=\"override-the-templates\">Override the templates<a class=\"heading-anchor\" href=\"#override-the-templates\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Extract the <a href=\"https://cloudflare.cecil.app/documentation/templates/lookup-rules/#built-in-templates\">built-in templates</a> to start from the originals:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar util:templates:extract</code></pre>\n<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>\n<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>\n<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>\n  </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\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">url</span>&gt;</span>\n    <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>\n    <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>\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">url</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{%- <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> ~%}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">urlset</span>&gt;</span></span></code></pre>\n<aside class=\"note note-tip\"><p>To disable one of these files, unpublish its default page:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">default:</span>\n    <span class=\"hljs-attr\">sitemap:</span>\n      <span class=\"hljs-attr\">published:</span> <span class=\"hljs-literal\">false</span></code></pre></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/templates-lqip-placeholder/",
      "url": "https://cloudflare.cecil.app/how-to/templates-lqip-placeholder/",
      "title": "Display image placeholders while loading",
      "summary": "Show a dominant color or a blurred preview while images load in Cecil templates.",
      "date_published": "2026-10-15T00:00:00+00:00",
      "date_modified": "2026-10-18T00:00:00+00:00","content_text": "Images are often the heaviest resources of a page. While they load, Cecil can fill their space with a dominant color or a Low-Quality Image Placeholder (LQIP), to avoid empty blocks and improve perceived performance.\nWith the html function\nThe simplest way is the placeholder option of the html function, set to color or lqip:\n{{ html(asset('images\/photo.jpg'), {alt: 'Description', loading: 'lazy'}, {placeholder: 'lqip'}) }}\nTo apply it to every image rendered with html, set a default in cecil.yml:\nlayouts:\n  images:\n    placeholder: color # `color` or `lqip`\nThe placeholder option of the html function only applies to JPEG, PNG and GIF images, and the lqip placeholder is ignored for animated GIFs.\nWith filters\nFor custom markup, use the filters directly:\n\nlqip: returns a tiny blurred version of the image as a data URL\ndominant_color: returns the dominant color of the image as a CSS color value (e.g. rgb(120 85 60))\n\nDominant color\n{% set image = asset('images\/photo.jpg') %}\n&lt;img src=\"{{ url(image) }}\" width=\"{{ image.width }}\" height=\"{{ image.height }}\" alt=\"Description\" loading=\"lazy\"\n  style=\"background-color: {{ image|dominant_color }};\"&gt;\nBlurred preview\n{% set image = asset('images\/photo.jpg') %}\n&lt;img src=\"{{ url(image) }}\" width=\"{{ image.width }}\" height=\"{{ image.height }}\" alt=\"Description\" loading=\"lazy\"\n  class=\"placeholder\" style=\"background-image: url({{ image|lqip }});\"&gt;\nStretch the preview over the image area with CSS:\nimg.placeholder {\n  max-width: 100%;\n  height: auto;\n  background-size: cover;\n  background-repeat: no-repeat;\n}\nThe background is visible until the real image is loaded and painted over it.\nImages in Markdown support placeholders too: ![](\/images\/photo.jpg){placeholder=lqip}, or globally with the pages.body.images.placeholder option.\nSee the documentation of the lqip filter, the dominant_color filter and the html function.",
      "content_html": "<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>\n<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>\n<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>\n<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>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">layouts:</span>\n  <span class=\"hljs-attr\">images:</span>\n    <span class=\"hljs-attr\">placeholder:</span> <span class=\"hljs-string\">color</span> <span class=\"hljs-comment\"># `color` or `lqip`</span></code></pre>\n<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>\n<h2 id=\"with-filters\">With filters<a class=\"heading-anchor\" href=\"#with-filters\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>For custom markup, use the filters directly:</p>\n<ul>\n<li><code translate=\"no\">lqip</code>: returns a tiny blurred version of the image as a data URL</li>\n<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>\n</ul>\n<h3 id=\"dominant-color\">Dominant color<a class=\"heading-anchor\" href=\"#dominant-color\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> image = asset('images/photo.jpg') %}</span><span class=\"xml\">\n<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>\n  <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>\n<h3 id=\"blurred-preview\">Blurred preview<a class=\"heading-anchor\" href=\"#blurred-preview\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> image = asset('images/photo.jpg') %}</span><span class=\"xml\">\n<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>\n  <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>\n<p>Stretch the preview over the image area with CSS:</p>\n<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> {\n  <span class=\"hljs-attribute\">max-width</span>: <span class=\"hljs-number\">100%</span>;\n  <span class=\"hljs-attribute\">height</span>: auto;\n  <span class=\"hljs-attribute\">background-size</span>: cover;\n  <span class=\"hljs-attribute\">background-repeat</span>: no-repeat;\n}</code></pre>\n<p>The background is visible until the real image is loaded and painted over it.</p>\n<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://cloudflare.cecil.app/documentation/configuration/pages/#pages-body-images\"><code translate=\"no\">pages.body.images.placeholder</code> option</a>.</p></aside>\n<aside class=\"note note-info\"><p>See the documentation of the <a href=\"https://cloudflare.cecil.app/documentation/assets/images/#lqip\"><code translate=\"no\">lqip</code> filter</a>, the <a href=\"https://cloudflare.cecil.app/documentation/assets/images/#dominant-color\"><code translate=\"no\">dominant_color</code> filter</a> and the <a href=\"https://cloudflare.cecil.app/documentation/templates/reference/functions/#html\"><code translate=\"no\">html</code> function</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/markdown-toc-notes/",
      "url": "https://cloudflare.cecil.app/how-to/markdown-toc-notes/",
      "title": "Add a table of contents and notes",
      "summary": "Enrich Cecil Markdown pages with a table of contents, note blocks and custom attributes.",
      "date_published": "2026-10-14T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Cecil extends Markdown with a few handy features for long pages: an automatic table of contents, note blocks and attributes on elements.\nInsert a table of contents\nAdd the [toc] tag where the table of contents should appear in the body of the page:\n[toc]\n\n## Installation\n### Requirements\n## Usage\nBy default, the table of contents is built from H2 and H3 headings. Change it in cecil.yml:\npages:\n  body:\n    toc: [h2, h3, h4]\nDisplay the table of contents in a template\nTo place the table of contents outside the content (e.g. in a sidebar), use the toc filter on the page body:\n&lt;aside&gt;\n  {{ page.body|toc }}\n&lt;\/aside&gt;\n&lt;article&gt;\n  {{ page.content }}\n&lt;\/article&gt;\nThe filter also accepts the headings to extract, e.g. {{ page.body|toc(selectors=['h2']) }}.\nAdd notes\nHighlight information with a note block:\n:::tip\n**Tip:** This is advice.\n:::\nIt is converted to:\n&lt;aside class=\"note note-tip\"&gt;\n  &lt;p&gt;\n    &lt;strong&gt;Tip:&lt;\/strong&gt; This is advice.\n  &lt;\/p&gt;\n&lt;\/aside&gt;\nAvailable types are info, tip, important, warning and caution (or no type). Style them with the note and note-&lt;type&gt; CSS classes.\nTo nest notes, use a longer fence for the parent note (::::, then ::::: for a third level, etc.):\n::::info\nBefore.\n\n:::tip\n**Tip:** This is advice.\n:::\n\nAfter.\n::::\nCecil also provides note templates to structure content without JavaScript: tabs, code-group, steps, accordion and cards. Their items are defined with #### headings (or list entries for cards), and each type is rendered with the partials\/notes\/&lt;type&gt;.html.twig template, which you can override.\nAdd attributes\nSet 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:\n## Installation {#install .highlighted}\nThe #install id gives a stable anchor to link to: [See installation](#install).\nFor an inline element, like a link, add a line break after the closing brace.\nSee the documentation of the table of contents, notes and their templates, attributes and the toc filter.",
      "content_html": "<p>Cecil extends Markdown with a few handy features for long pages: an automatic table of contents, note blocks and attributes on elements.</p>\n<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>\n<p>Add the <code translate=\"no\">[toc]</code> tag where the table of contents should appear in the body of the page:</p>\n<pre data-lang=\"markdown\"><code class=\"language-markdown hljs markdown\" translate=\"no\">[toc]\n\n<span class=\"hljs-section\">## Installation</span>\n<span class=\"hljs-section\">### Requirements</span>\n<span class=\"hljs-section\">## Usage</span></code></pre>\n<p>By default, the table of contents is built from H2 and H3 headings. Change it in <code translate=\"no\">cecil.yml</code>:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">body:</span>\n    <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>\n<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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">aside</span>&gt;</span>\n  </span><span class=\"hljs-template-variable\">{{ page.body|toc }}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">aside</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">article</span>&gt;</span>\n  </span><span class=\"hljs-template-variable\">{{ page.content }}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">article</span>&gt;</span></span></code></pre>\n<p>The filter also accepts the headings to extract, e.g. <code translate=\"no\">{{ page.body|toc(selectors=['h2']) }}</code>.</p>\n<h2 id=\"add-notes\">Add notes<a class=\"heading-anchor\" href=\"#add-notes\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Highlight information with a note block:</p>\n<pre data-lang=\"markdown\"><code class=\"language-markdown hljs markdown\" translate=\"no\">:::tip\n<span class=\"hljs-strong\">**Tip:**</span> This is advice.\n:::</code></pre>\n<p>It is converted to:</p>\n<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>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">p</span>&gt;</span>\n    <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.\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">p</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">aside</span>&gt;</span></code></pre>\n<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>\n<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>\n<pre data-lang=\"markdown\"><code class=\"language-markdown hljs markdown\" translate=\"no\">::::info\nBefore.\n\n:::tip\n<span class=\"hljs-strong\">**Tip:**</span> This is advice.\n:::\n\nAfter.\n::::</code></pre>\n<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>\n<h2 id=\"add-attributes\">Add attributes<a class=\"heading-anchor\" href=\"#add-attributes\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"markdown\"><code class=\"language-markdown hljs markdown\" translate=\"no\"><span class=\"hljs-section\">## Installation {#install .highlighted}</span></code></pre>\n<p>The <code translate=\"no\">#install</code> id gives a stable anchor to link to: <code translate=\"no\">[See installation](#install)</code>.</p>\n<aside class=\"note note-warning\"><p>For an inline element, like a link, add a line break after the closing brace.</p></aside>\n<aside class=\"note note-info\"><p>See the documentation of the <a href=\"https://cloudflare.cecil.app/documentation/content/markdown/#table-of-contents\">table of contents</a>, <a href=\"https://cloudflare.cecil.app/documentation/content/markdown/#notes\">notes</a> and their <a href=\"https://cloudflare.cecil.app/documentation/content/markdown/#templates\">templates</a>, <a href=\"https://cloudflare.cecil.app/documentation/content/markdown/#attributes\">attributes</a> and the <a href=\"https://cloudflare.cecil.app/documentation/templates/reference/filters/#toc\"><code translate=\"no\">toc</code> filter</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/content-redirect-alias/",
      "url": "https://cloudflare.cecil.app/how-to/content-redirect-alias/",
      "title": "Redirect old URLs",
      "summary": "Keep old links working in Cecil with the redirect and alias front matter variables.",
      "date_published": "2026-10-13T00:00:00+00:00",
      "date_modified": "2026-10-20T00:00:00+00:00","content_text": "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: alias and redirect.\nRedirect old URLs to a page\nThe alias variable lists the old paths of the current page. Each of them redirects to the page:\n---\ntitle: About\nalias:\n  - company\n  - about-us\n---\nIn this example, \/company\/ and \/about-us\/ redirect to \/about\/.\nRedirect a page to another URL\nThe redirect variable turns a page into a redirection to the given URL, internal or external:\n---\ntitle: Old documentation\nredirect: \"https:\/\/cecil.app\/documentation\/\"\n---\nWithout a Markdown file\nIf the old page has no content anymore, declare it as a default page in cecil.yml, indexed by ID:\npages:\n  default:\n    code:\n      path: code\n      redirect: https:\/\/github.com\/Cecilapp\/Cecil\nGenerated pages\nFor each alias and each redirection, Cecil renders a page with the built-in redirect.html.twig template. It contains:\n\na &lt;link rel=\"canonical\"&gt; to the target URL\na &lt;meta name=\"robots\" content=\"noindex\"&gt; tag, so search engines don’t index it\na &lt;meta http-equiv=\"refresh\"&gt; tag and a JavaScript redirection\na fallback link for visitors\n\nTo customize this page, create your own layouts\/redirect.html.twig template: it takes precedence over the built-in one.\nSee the documentation of the redirect and alias variables.",
      "content_html": "<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>\n<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>\n<p>The <code translate=\"no\">alias</code> variable lists the old paths of the current page. Each of them redirects to the page:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">About</span>\n<span class=\"hljs-attr\">alias:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">company</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-string\">about-us</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<p>In this example, <code translate=\"no\">/company/</code> and <code translate=\"no\">/about-us/</code> redirect to <code translate=\"no\">/about/</code>.</p>\n<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>\n<p>The <code translate=\"no\">redirect</code> variable turns a page into a redirection to the given URL, internal or external:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Old</span> <span class=\"hljs-string\">documentation</span>\n<span class=\"hljs-attr\">redirect:</span> <span class=\"hljs-string\">\"https://cecil.app/documentation/\"</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<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>\n<p>If the old page has no content anymore, declare it as a <a href=\"https://cloudflare.cecil.app/documentation/configuration/pages/#pages-default\">default page</a> in <code translate=\"no\">cecil.yml</code>, indexed by ID:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">default:</span>\n    <span class=\"hljs-attr\">code:</span>\n      <span class=\"hljs-attr\">path:</span> <span class=\"hljs-string\">code</span>\n      <span class=\"hljs-attr\">redirect:</span> <span class=\"hljs-string\">https://github.com/Cecilapp/Cecil</span></code></pre>\n<h2 id=\"generated-pages\">Generated pages<a class=\"heading-anchor\" href=\"#generated-pages\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<ul>\n<li>a <code translate=\"no\">&lt;link rel=\"canonical\"&gt;</code> to the target URL</li>\n<li>a <code translate=\"no\">&lt;meta name=\"robots\" content=\"noindex\"&gt;</code> tag, so search engines don’t index it</li>\n<li>a <code translate=\"no\">&lt;meta http-equiv=\"refresh\"&gt;</code> tag and a JavaScript redirection</li>\n<li>a fallback link for visitors</li>\n</ul>\n<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>\n<aside class=\"note note-info\"><p>See the documentation of the <a href=\"https://cloudflare.cecil.app/documentation/content/front-matter/#redirect\"><code translate=\"no\">redirect</code></a> and <a href=\"https://cloudflare.cecil.app/documentation/content/front-matter/#alias\"><code translate=\"no\">alias</code></a> variables.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/config-environments/",
      "url": "https://cloudflare.cecil.app/how-to/config-environments/",
      "title": "Use different settings per environment",
      "summary": "Override the Cecil configuration per environment with CECIL_ environment variables and extra config files.",
      "date_published": "2026-10-12T00:00:00+00:00",
      "date_modified": "2026-10-18T00:00:00+00:00","content_text": "Your local site and your production site rarely share the same settings: base URL, debug mode, output directory… Cecil lets you keep a single cecil.yml and override it per environment.\nKeep production values in cecil.yml\ntitle: \"My site\"\nbaseurl: https:\/\/example.com\/\ndebug: false\nOverride with extra config files\nCreate a file with only the keys to change, for example config\/dev.yml:\ndebug: true\ncache:\n  enabled: false\nThen load it with the --config option, available with the build and serve commands:\nphp cecil.phar serve --config=config\/dev.yml\nYou don’t need to set baseurl for local preview: the serve command builds the site with its own local URL (e.g. http:\/\/localhost:8000\/), unless the CECIL_BASEURL environment variable is set, including in a .env file (see below).\nYou can pass several files, separated by commas. They are merged in order after cecil.yml, so each file overrides the previous ones:\nphp cecil.phar build --config=config\/prod.yml,config\/local.yml\nLists of values are replaced, not merged: if cecil.yml defines pages.body.toc: [h2, h3] and an extra file defines pages.body.toc: [h4], the result is [h4]. To add or remove a value instead, use a map of booleans (e.g. pages.body.toc: {h4: true}). Lists of entries, such as menus, are concatenated. See lists.\nOverride with environment variables\nAny configuration key can be set with an environment variable prefixed with CECIL_, in uppercase. Nested keys are separated with an underscore (e.g. CECIL_OUTPUT_DIR sets output.dir):\nexport CECIL_BASEURL=\"https:\/\/staging.example.com\/\"\nexport CECIL_DEBUG=true\nphp cecil.phar build\nAs each underscore is turned into a dot, keys that contain an underscore (e.g. pages.body.images.dark_suffix) can’t be set with an environment variable.\nCecil also loads a .env file from the site root, if it exists (variables already defined by the system are preserved):\nCECIL_TITLE=\"My site (preview)\"\nCECIL_DEBUG=true\nEnvironment variables are applied last, on top of the configuration files and of command options such as --baseurl, which makes them handy in CI, for example:\n# .gitlab-ci.yml\npages:\n  variables:\n    CECIL_ENV: production\n    CECIL_OUTPUT_DIR: public\nRead the environment in templates\nUse the getenv function to adapt templates, for example to include analytics in production only:\n{% if getenv('CECIL_ENV') == 'production' %}\n  {{ include('partials\/analytics.html.twig') }}\n{% endif %}\nThe site.debug variable tells you if debug mode is enabled:\n{% if site.debug %}{{ dump(page) }}{% endif %}\nSee the documentation for overriding the configuration, the debug option and the getenv function.",
      "content_html": "<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>\n<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>\n<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>\n<span class=\"hljs-attr\">baseurl:</span> <span class=\"hljs-string\">https://example.com/</span>\n<span class=\"hljs-attr\">debug:</span> <span class=\"hljs-literal\">false</span></code></pre>\n<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>\n<p>Create a file with only the keys to change, for example <code translate=\"no\">config/dev.yml</code>:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">debug:</span> <span class=\"hljs-literal\">true</span>\n<span class=\"hljs-attr\">cache:</span>\n  <span class=\"hljs-attr\">enabled:</span> <span class=\"hljs-literal\">false</span></code></pre>\n<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>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar serve --config=config/dev.yml</code></pre>\n<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>\n<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>\n<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>\n<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://cloudflare.cecil.app/documentation/configuration/#lists\">lists</a>.</p></aside>\n<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>\n<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>\n<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>\n<span class=\"hljs-built_in\">export</span> CECIL_DEBUG=<span class=\"hljs-literal\">true</span>\nphp cecil.phar build</code></pre>\n<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>\n<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>\n<pre data-lang=\"dotenv\"><code class=\"language-dotenv\" translate=\"no\">CECIL_TITLE=\"My site (preview)\"\nCECIL_DEBUG=true</code></pre>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-comment\"># .gitlab-ci.yml</span>\n<span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">variables:</span>\n    <span class=\"hljs-attr\">CECIL_ENV:</span> <span class=\"hljs-string\">production</span>\n    <span class=\"hljs-attr\">CECIL_OUTPUT_DIR:</span> <span class=\"hljs-string\">public</span></code></pre>\n<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>\n<p>Use the <code translate=\"no\">getenv</code> function to adapt templates, for example to include analytics in production only:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> getenv('CECIL_ENV') == 'production' %}</span><span class=\"xml\">\n  </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\">\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<p>The <code translate=\"no\">site.debug</code> variable tells you if debug mode is enabled:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> 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>\n<aside class=\"note note-info\"><p>See the documentation for <a href=\"https://cloudflare.cecil.app/documentation/configuration/override/\">overriding the configuration</a>, the <a href=\"https://cloudflare.cecil.app/documentation/configuration/site/#debug\"><code translate=\"no\">debug</code> option</a> and the <a href=\"https://cloudflare.cecil.app/documentation/templates/reference/functions/#getenv\"><code translate=\"no\">getenv</code> function</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/templates-assets-scss/",
      "url": "https://cloudflare.cecil.app/how-to/templates-assets-scss/",
      "title": "Compile, minify and fingerprint CSS and JavaScript",
      "summary": "Process Sass, CSS and JavaScript files in Cecil templates with the asset function and its filters.",
      "date_published": "2026-10-11T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Cecil can compile Sass files, minify CSS and JavaScript, and add a content hash to file names (cache busting) directly from your templates, without any external build tool.\nConfigure asset processing\nSource files are stored in the assets\/ directory. Processing is enabled by default and can be tuned in cecil.yml:\nassets:\n  compile:\n    style: compressed                  # `expanded` (default) or `compressed`\n    import: [sass, scss, node_modules] # imported directories (default)\n  minify: true                         # minifies CSS and JS\n  fingerprint: true                    # adds content hash to file names\nLoad a stylesheet\nCreate an asset from a Sass file and render the &lt;link&gt; element with the html function. The Sass file is compiled to CSS, then minified and fingerprinted according to the configuration:\n{{ html(asset('css\/styles.scss')) }}\nFilters can be chained to apply each step explicitly, which is useful if a feature (such as minify or fingerprint) is disabled globally:\n{{ asset('css\/styles.scss')|to_css|minify|fingerprint }}\nBundle JavaScript files\nPass an array of paths to create a single bundle, with a custom file name:\n{{ html(asset(['js\/menu.js', 'js\/search.js'], {filename: 'scripts.js'})) }}\nOptions can also be set per asset, for example to skip the minification of a remote file that is already minified:\n{{ html(asset('https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/anchor-js\/4.3.1\/anchor.min.js', {minify: false})) }}\nAdd Subresource Integrity\nUse the integrity function (or the integrity attribute of the asset) to generate a sha384 hash:\n{% set styles = asset('css\/styles.scss') %}\n&lt;link rel=\"stylesheet\" href=\"{{ url(styles) }}\" integrity=\"{{ integrity(styles) }}\" crossorigin=\"anonymous\"&gt;\nInline critical CSS\nOutput the content of an asset with the inline filter:\n&lt;style&gt;{{ asset('css\/critical.scss')|to_css|minify|inline }}&lt;\/style&gt;\nFor a few lines of styles written directly in the template, use the scss_to_css and minify_css filters:\n&lt;style&gt;\n{% apply scss_to_css|minify_css %}\n  $color: #fcfcfc;\n  body {\n    background-color: $color;\n  }\n{% endapply %}\n&lt;\/style&gt;\nSee the documentation of the asset function, the integrity function, the processing filters and the assets configuration.",
      "content_html": "<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>\n<h2 id=\"configure-asset-processing\">Configure asset processing<a class=\"heading-anchor\" href=\"#configure-asset-processing\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">assets:</span>\n  <span class=\"hljs-attr\">compile:</span>\n    <span class=\"hljs-attr\">style:</span> <span class=\"hljs-string\">compressed</span>                  <span class=\"hljs-comment\"># `expanded` (default) or `compressed`</span>\n    <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>\n  <span class=\"hljs-attr\">minify:</span> <span class=\"hljs-literal\">true</span>                         <span class=\"hljs-comment\"># minifies CSS and JS</span>\n  <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>\n<h2 id=\"load-a-stylesheet\">Load a stylesheet<a class=\"heading-anchor\" href=\"#load-a-stylesheet\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<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>\n<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>\n<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>\n<h2 id=\"bundle-javascript-files\">Bundle JavaScript files<a class=\"heading-anchor\" href=\"#bundle-javascript-files\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Pass an array of paths to create a single bundle, with a custom file name:</p>\n<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>\n<p>Options can also be set per asset, for example to skip the minification of a remote file that is already minified:</p>\n<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>\n<h2 id=\"add-subresource-integrity\">Add Subresource Integrity<a class=\"heading-anchor\" href=\"#add-subresource-integrity\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> styles = asset('css/styles.scss') %}</span><span class=\"xml\">\n<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>\n<h2 id=\"inline-critical-css\">Inline critical CSS<a class=\"heading-anchor\" href=\"#inline-critical-css\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Output the content of an asset with the <code translate=\"no\">inline</code> filter:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">style</span>&gt;</span>\n</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\">\n  $color: #fcfcfc;\n  body {\n    background-color: $color;\n  }\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endapply</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">style</span>&gt;</span></span></code></pre>\n<aside class=\"note note-info\"><p>See the documentation of the <a href=\"https://cloudflare.cecil.app/documentation/assets/#asset\"><code translate=\"no\">asset</code> function</a>, the <a href=\"https://cloudflare.cecil.app/documentation/assets/#integrity\"><code translate=\"no\">integrity</code> function</a>, the <a href=\"https://cloudflare.cecil.app/documentation/assets/processing/\">processing filters</a> and the <a href=\"https://cloudflare.cecil.app/documentation/configuration/assets/\">assets configuration</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/content-taxonomies/",
      "url": "https://cloudflare.cecil.app/how-to/content-taxonomies/",
      "title": "Organize pages with tags and categories",
      "summary": "Classify Cecil pages with taxonomies like tags and categories, and customize their list pages.",
      "date_published": "2026-10-10T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Taxonomies let you classify pages with terms (e.g. PHP) grouped in vocabularies (e.g. tags). Cecil then generates a page per vocabulary and a page per term.\nDeclare vocabularies\nVocabularies are declared in cecil.yml, paired by plural and singular names:\ntaxonomies:\n  categories: category\n  tags: tag\nThere are no default vocabularies: you must declare them to use them.\nClassify pages\nAdd terms in the front matter of your pages, using the plural name of the vocabulary:\n---\ntitle: My first post\ncategories: [\"Development\"]\ntags: [\"PHP\", \"Static site\"]\n---\nCecil generates:\n\n\/tags\/: the list of the terms of the vocabulary\n\/tags\/php\/ and \/tags\/static-site\/: the list of the pages of each term\n\nCustomize the list of terms\nThe vocabulary template is named after the plural, e.g. layouts\/taxonomy\/tags.html.twig:\n{% extends 'page.html.twig' %}\n\n{% block content %}\n  &lt;h1&gt;{{ page.title }}&lt;\/h1&gt;\n  &lt;ul&gt;\n  {% for term in page.terms %}\n    &lt;li&gt;&lt;a href=\"{{ url(term.id, {language: site.language}) }}\"&gt;{{ term.name }}&lt;\/a&gt; ({{ term|length }})&lt;\/li&gt;\n  {% endfor %}\n  &lt;\/ul&gt;\n{% endblock %}\nCustomize the pages of a term\nThe term template is named after the singular, e.g. layouts\/taxonomy\/tag.html.twig:\n{% extends 'page.html.twig' %}\n\n{% block content %}\n  &lt;h1&gt;{{ page.title }}&lt;\/h1&gt;\n  {% for p in page.paginator.pages ?? page.pages %}\n    &lt;article&gt;\n      &lt;h2&gt;&lt;a href=\"{{ url(p) }}\"&gt;{{ p.title }}&lt;\/a&gt;&lt;\/h2&gt;\n    &lt;\/article&gt;\n  {% endfor %}\n  &lt;a href=\"{{ url(page.plural, {language: site.language}) }}\"&gt;All {{ page.plural }}&lt;\/a&gt;\n{% endblock %}\nDisplay the terms of a page\nIn a page template, link each term to its page:\n{% for tag in page.tags ?? [] %}\n  &lt;a href=\"{{ url('tags\/' ~ tag, {language: site.language}) }}\"&gt;{{ tag }}&lt;\/a&gt;\n{% endfor %}\nThe language option keeps links in the current language on a multilingual site.\nOr use the built-in partial: {{ include('partials\/terms-list.html.twig', {vocabulary: 'tags'}) }}.\nSee the documentation of taxonomies configuration, templates lookup rules and taxonomy variables.",
      "content_html": "<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>\n<h2 id=\"declare-vocabularies\">Declare vocabularies<a class=\"heading-anchor\" href=\"#declare-vocabularies\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Vocabularies are declared in <code translate=\"no\">cecil.yml</code>, paired by plural and singular names:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">taxonomies:</span>\n  <span class=\"hljs-attr\">categories:</span> <span class=\"hljs-string\">category</span>\n  <span class=\"hljs-attr\">tags:</span> <span class=\"hljs-string\">tag</span></code></pre>\n<aside class=\"note note-warning\"><p>There are no default vocabularies: you must declare them to use them.</p></aside>\n<h2 id=\"classify-pages\">Classify pages<a class=\"heading-anchor\" href=\"#classify-pages\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Add terms in the front matter of your pages, using the plural name of the vocabulary:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">My</span> <span class=\"hljs-string\">first</span> <span class=\"hljs-string\">post</span>\n<span class=\"hljs-attr\">categories:</span> <span class=\"hljs-string\">[\"Development\"]</span>\n<span class=\"hljs-attr\">tags:</span> <span class=\"hljs-string\">[\"PHP\",</span> <span class=\"hljs-string\">\"Static site\"</span><span class=\"hljs-string\">]</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<p>Cecil generates:</p>\n<ul>\n<li><code translate=\"no\">/tags/</code>: the list of the terms of the vocabulary</li>\n<li><code translate=\"no\">/tags/php/</code> and <code translate=\"no\">/tags/static-site/</code>: the list of the pages of each term</li>\n</ul>\n<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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">extends</span></span> 'page.html.twig' %}</span><span class=\"xml\">\n\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">block</span></span> content %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ page.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">h1</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ul</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> term in page.terms %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(term.id, {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>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">ul</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endblock</span></span> %}</span></code></pre>\n<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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">extends</span></span> 'page.html.twig' %}</span><span class=\"xml\">\n\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">block</span></span> content %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h1</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ page.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">h1</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> p in page.paginator.pages ?? page.pages %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">article</span>&gt;</span>\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h2</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(p) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ p.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">h2</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">article</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.plural, {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>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endblock</span></span> %}</span></code></pre>\n<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>\n<p>In a page template, link each term to its page:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> tag in page.tags ?? [] %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url('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>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre>\n<p>The <code translate=\"no\">language</code> option keeps links in the current language on a multilingual site.</p>\n<p>Or use the built-in partial: <code translate=\"no\">{{ include('partials/terms-list.html.twig', {vocabulary: 'tags'}) }}</code>.</p>\n<aside class=\"note note-info\"><p>See the documentation of <a href=\"https://cloudflare.cecil.app/documentation/configuration/site/#taxonomies\">taxonomies configuration</a>, <a href=\"https://cloudflare.cecil.app/documentation/templates/lookup-rules/#type-vocabulary\">templates lookup rules</a> and <a href=\"https://cloudflare.cecil.app/documentation/templates/variables/#taxonomy\">taxonomy variables</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/templates-menus/",
      "url": "https://cloudflare.cecil.app/how-to/templates-menus/",
      "title": "Build a navigation menu",
      "summary": "Declare menus in Cecil configuration or front matter and render them in templates.",
      "date_published": "2026-10-09T00:00:00+00:00",
      "date_modified": "2026-10-18T00:00:00+00:00","content_text": "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.\nDeclare entries in configuration\nAdd a menus section in cecil.yml. Each menu (e.g. main, footer) is a list of entries with a unique id:\nmenus:\n  main:\n    - id: about\n      name: \"About\"\n      url: \/about\/\n      weight: 1\n  footer:\n    - id: github\n      name: \"GitHub\"\n      url: https:\/\/github.com\/Cecilapp\/Cecil\n      weight: 99\nA main menu is automatically created with the home page entry and the top-level section entries (unless they define their own menu variable).\nAdd a page from its front matter\nA page can add itself to one or more menus with the menu variable. The entry name is the page title and the URL is the page path:\n---\ntitle: Our Expertise\nmenu:\n  main:\n    weight: 15\n  footer:\n    weight: 15\n    name: \"Expertise\" # override the entry name in this menu\n---\nOverride or disable an entry\nUse the page ID as id to override an existing entry, or enabled: false to remove it:\nmenus:\n  main:\n    - id: index\n      name: \"Home\"\n      weight: 1\n    - id: about\n      enabled: false\nRender the menu\nLoop over site.menus.&lt;menu&gt;, sorted by weight, and compare each entry ID with the current page ID to highlight the active item:\n&lt;nav&gt;\n  &lt;ul&gt;\n  {% for entry in site.menus.main|sort_by_weight %}\n    &lt;li&gt;\n      &lt;a href=\"{{ url(entry.url) }}\"{% if entry.id == page.id %} aria-current=\"page\" class=\"active\"{% endif %}&gt;{{ entry.name }}&lt;\/a&gt;\n    &lt;\/li&gt;\n  {% endfor %}\n  &lt;\/ul&gt;\n&lt;\/nav&gt;\nThe ID of a page entry doesn't include the language prefix (e.g. about for the fr\/about page), while page.id does. On a multilingual site, compare URLs instead: {% if url(entry.url) == url(page) %}.\nA single entry can also be reached by its ID:\n{% if site.menus.main.about is defined %}\n  &lt;a href=\"{{ url(site.menus.main.about.url) }}\"&gt;{{ site.menus.main.about.name }}&lt;\/a&gt;\n{% endif %}\nCecil also provides a built-in partial, without active item highlighting: {{ include('partials\/navigation.html.twig', {menu: 'main'}) }}.\nSee the documentation of the menus configuration, the menu front matter variable and the site.menus variable.",
      "content_html": "<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>\n<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>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">menus:</span>\n  <span class=\"hljs-attr\">main:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">id:</span> <span class=\"hljs-string\">about</span>\n      <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">\"About\"</span>\n      <span class=\"hljs-attr\">url:</span> <span class=\"hljs-string\">/about/</span>\n      <span class=\"hljs-attr\">weight:</span> <span class=\"hljs-number\">1</span>\n  <span class=\"hljs-attr\">footer:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">id:</span> <span class=\"hljs-string\">github</span>\n      <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">\"GitHub\"</span>\n      <span class=\"hljs-attr\">url:</span> <span class=\"hljs-string\">https://github.com/Cecilapp/Cecil</span>\n      <span class=\"hljs-attr\">weight:</span> <span class=\"hljs-number\">99</span></code></pre>\n<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>\n<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>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Our</span> <span class=\"hljs-string\">Expertise</span>\n<span class=\"hljs-attr\">menu:</span>\n  <span class=\"hljs-attr\">main:</span>\n    <span class=\"hljs-attr\">weight:</span> <span class=\"hljs-number\">15</span>\n  <span class=\"hljs-attr\">footer:</span>\n    <span class=\"hljs-attr\">weight:</span> <span class=\"hljs-number\">15</span>\n    <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">\"Expertise\"</span> <span class=\"hljs-comment\"># override the entry name in this menu</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<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>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">menus:</span>\n  <span class=\"hljs-attr\">main:</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">id:</span> <span class=\"hljs-string\">index</span>\n      <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">\"Home\"</span>\n      <span class=\"hljs-attr\">weight:</span> <span class=\"hljs-number\">1</span>\n    <span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">id:</span> <span class=\"hljs-string\">about</span>\n      <span class=\"hljs-attr\">enabled:</span> <span class=\"hljs-literal\">false</span></code></pre>\n<h2 id=\"render-the-menu\">Render the menu<a class=\"heading-anchor\" href=\"#render-the-menu\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">nav</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ul</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> entry in site.menus.main|sort_by_weight %}</span><span class=\"xml\">\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li</span>&gt;</span>\n      <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(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>\n    <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">li</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">ul</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">nav</span>&gt;</span></span></code></pre>\n<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>\n<p>A single entry can also be reached by its ID:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> site.menus.main.about is defined %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(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>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<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>\n<aside class=\"note note-info\"><p>See the documentation of the <a href=\"https://cloudflare.cecil.app/documentation/configuration/site/#menus\">menus configuration</a>, the <a href=\"https://cloudflare.cecil.app/documentation/content/front-matter/#menu\"><code translate=\"no\">menu</code> front matter variable</a> and the <a href=\"https://cloudflare.cecil.app/documentation/templates/variables/#site-menus\"><code translate=\"no\">site.menus</code> variable</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/output-search-index/",
      "url": "https://cloudflare.cecil.app/how-to/output-search-index/",
      "title": "Add client-side search",
      "summary": "Add a client-side search to a Cecil static site with a JSON index of pages and a small JavaScript library.",
      "date_published": "2026-10-08T00:00:00+00:00",
      "date_modified": "2026-10-20T00:00:00+00:00","content_text": "A static site has no server-side search, but Cecil can generate a JSON index of your pages at build time. A few lines of JavaScript are then enough to search it in the browser.\nCreate the index page\nCreate a page whose only output format is json, with a dedicated layout:\npages\/search.md\n---\ntitle: Search index\nlayout: search\noutput: json\nexcluded: true\n---\nexcluded: true keeps this technical page out of list pages and the sitemap.\nWrite the JSON template\nFollowing the lookup rules, Cecil renders this page with layouts\/search.json.twig. Build an array of the showable pages, then encode it:\n{%- set index = [] -%}\n{%- for p in site.pages.showable|filter(p =&gt; p.type == 'page') -%}\n  {%- set index = index|merge([{\n    title: p.title,\n    url: url(p),\n    description: p.description|default(''),\n    content: p.content|striptags|excerpt(300)\n  }]) -%}\n{%- endfor -%}\n{{ index|json_encode(constant('JSON_UNESCAPED_UNICODE') b-or constant('JSON_UNESCAPED_SLASHES'))|raw }}\nAfter php cecil.phar build, the index is available at \/search.json.\nsite.pages.showable also includes pages without content file: the p.type == 'page' filter keeps sections and taxonomies out of the index, but pages created by a generator or declared in pages.default are indexed, unless they have excluded: true.\nSearch with Fuse.js\nAdd a search field to a template and load Fuse.js from a CDN to query the index:\n&lt;input type=\"search\" id=\"search\" placeholder=\"Search…\"&gt;\n&lt;ul id=\"results\"&gt;&lt;\/ul&gt;\n\n&lt;script type=\"module\"&gt;\n  import Fuse from 'https:\/\/cdn.jsdelivr.net\/npm\/fuse.js@7\/dist\/fuse.mjs';\n\n  const index = await fetch('{{ url('search', {format: 'json'}) }}').then(r =&gt; r.json());\n  const fuse = new Fuse(index, { keys: ['title', 'description', 'content'], threshold: 0.3 });\n  const results = document.getElementById('results');\n\n  document.getElementById('search').addEventListener('input', (e) =&gt; {\n    results.replaceChildren(...fuse.search(e.target.value, { limit: 10 }).map(({ item }) =&gt; {\n      const li = document.createElement('li');\n      const a = document.createElement('a');\n      a.href = item.url;\n      a.textContent = item.title;\n      li.append(a);\n      return li;\n    }));\n  });\n&lt;\/script&gt;\nAlternative: Pagefind\nPagefind indexes the generated HTML files instead: no JSON template is needed. Run it after the build, on the output directory (_site by default):\nphp cecil.phar build\nnpx pagefind --site _site\nThen load its UI in a template:\n&lt;link href=\"\/pagefind\/pagefind-ui.css\" rel=\"stylesheet\"&gt;\n&lt;script src=\"\/pagefind\/pagefind-ui.js\"&gt;&lt;\/script&gt;\n&lt;div id=\"search\"&gt;&lt;\/div&gt;\n&lt;script&gt;\n  window.addEventListener('DOMContentLoaded', () =&gt; new PagefindUI({ element: '#search' }));\n&lt;\/script&gt;\nThe index is a regular page: to regenerate only JSON outputs, declare a subset and run php cecil.phar build --render-subset=&lt;name&gt;.\nSee the output variable, the output formats and the url function documentation.",
      "content_html": "<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>\n<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>\n<p>Create a page whose only <a href=\"https://cloudflare.cecil.app/documentation/content/front-matter/#output\">output format</a> is <code translate=\"no\">json</code>, with a dedicated layout:</p>\n<p><em>pages/search.md</em></p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Search</span> <span class=\"hljs-string\">index</span>\n<span class=\"hljs-attr\">layout:</span> <span class=\"hljs-string\">search</span>\n<span class=\"hljs-attr\">output:</span> <span class=\"hljs-string\">json</span>\n<span class=\"hljs-attr\">excluded:</span> <span class=\"hljs-literal\">true</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<p><a href=\"https://cloudflare.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>\n<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>\n<p>Following the <a href=\"https://cloudflare.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://cloudflare.cecil.app/documentation/templates/variables/#site\">showable</a> pages, then encode it:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{%- <span class=\"hljs-name\"><span class=\"hljs-keyword\">set</span></span> index = [] -%}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{%- <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> p in site.pages.showable|<span class=\"hljs-keyword\">filter</span>(p =&gt; p.type == 'page') -%}</span><span class=\"xml\">\n  </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>([{\n    title: p.title,\n    url: url(p),\n    description: p.description|<span class=\"hljs-keyword\">default</span>(''),\n    content: p.content|<span class=\"hljs-keyword\">striptags</span>|excerpt(300)\n  }]) -%}</span><span class=\"xml\">\n</span><span class=\"hljs-template-tag\">{%- <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> -%}</span><span class=\"xml\">\n</span><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>\n<p>After <code translate=\"no\">php cecil.phar build</code>, the index is available at <code translate=\"no\">/search.json</code>.</p>\n<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>\n<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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">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>\n<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>\n\n<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\">\n  <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>;\n\n  <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());\n  const fuse = new Fuse(index, { keys: ['title', 'description', 'content'], threshold: 0.3 });\n  const results = document.getElementById('results');\n\n  document.getElementById('search').addEventListener('input', (e) =&gt; {\n    results.replaceChildren(...fuse.search(e.target.value, { limit: 10 }).map(({ item }) =&gt; {\n      const li = document.createElement('li');\n      const a = document.createElement('a');\n      a.href = item.url;\n      a.textContent = item.title;\n      li.append(a);\n      return li;\n    }));\n  });\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">script</span>&gt;</span></span></code></pre>\n<h2 id=\"alternative-pagefind\">Alternative: Pagefind<a class=\"heading-anchor\" href=\"#alternative-pagefind\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar build\nnpx pagefind --site _site</code></pre>\n<p>Then load its UI in a template:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">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>\n<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>\n<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>\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script</span>&gt;</span><span class=\"javascript\">\n  <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> }));\n</span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">script</span>&gt;</span></span></code></pre>\n<aside class=\"note note-tip\"><p>The index is a regular page: to regenerate only JSON outputs, declare a <a href=\"https://cloudflare.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>\n<aside class=\"note note-info\"><p>See the <a href=\"https://cloudflare.cecil.app/documentation/content/front-matter/#output\"><code translate=\"no\">output</code> variable</a>, the <a href=\"https://cloudflare.cecil.app/documentation/configuration/output/#output-formats\">output formats</a> and the <a href=\"https://cloudflare.cecil.app/documentation/templates/reference/functions/#url\"><code translate=\"no\">url</code> function</a> documentation.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/deploy-github-pages/",
      "url": "https://cloudflare.cecil.app/how-to/deploy-github-pages/",
      "title": "Deploy to GitHub Pages with GitHub Actions",
      "summary": "Build and deploy a Cecil site to GitHub Pages automatically with the Cecil GitHub Action.",
      "date_published": "2026-10-07T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "With the Cecil Action, every push to your repository builds the site and publishes it to GitHub Pages, with no server to manage.\nEnable GitHub Pages\nIn your repository, go to Settings → Pages and, under Build and deployment, set Source to GitHub Actions.\nAdd the workflow\nCreate the file .github\/workflows\/build-and-deploy.yml:\nname: Build and deploy to GitHub Pages\non:\n  push:\n    branches: [master, main]\n  workflow_dispatch:\nconcurrency:\n  group: pages\n  cancel-in-progress: true\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout source\n        uses: actions\/checkout@v7\n      - name: Build site\n        uses: Cecilapp\/Action@v4\n  deploy:\n    needs: build\n    permissions:\n      pages: write\n      id-token: write\n    environment:\n      name: github-pages\n      url: ${{ steps.deployment.outputs.page_url }}\n    runs-on: ubuntu-latest\n    steps:\n      - name: Deploy to GitHub Pages\n        id: deployment\n        uses: actions\/deploy-pages@v5\nThe build job downloads Cecil, installs themes (if a composer.json file exists), builds the site and uploads the output directory as a Pages artifact. The deploy job then publishes it.\nBase URL\nYou don’t need to change baseurl in cecil.yml: the action builds the site with the URL provided by GitHub Pages (e.g. https:\/\/&lt;user&gt;.github.io\/&lt;repository&gt;\/), using the --baseurl option.\nCustomize the build\nThe action accepts the following optional inputs:\n      - name: Build site\n        uses: Cecilapp\/Action@v4\n        with:\n          path: docs             # site directory, relative to the repository root (`.` by default)\n          version: '9.13.0'      # Cecil version (latest by default)\n          install_themes: 'no'   # skip themes installation (`yes` by default)\n          options: '-v --drafts' # build command options (`-v` by default)\nThe action uploads the _site directory of the site, or the directory given with the --output (-o) option in options: it doesn’t read output.dir from cecil.yml. If you change the output directory, pass it in options, e.g. options: '-v --output=public'.\nTo speed up builds, you can also restore and save the .cache directory between runs: see the full workflow in the GitHub Pages deployment documentation, and the list of build options.",
      "content_html": "<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>\n<h2 id=\"enable-github-pages\">Enable GitHub Pages<a class=\"heading-anchor\" href=\"#enable-github-pages\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<h2 id=\"add-the-workflow\">Add the workflow<a class=\"heading-anchor\" href=\"#add-the-workflow\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Create the file <code translate=\"no\">.github/workflows/build-and-deploy.yml</code>:</p>\n<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>\n<span class=\"hljs-attr\">on:</span>\n  <span class=\"hljs-attr\">push:</span>\n    <span class=\"hljs-attr\">branches:</span> <span class=\"hljs-string\">[master,</span> <span class=\"hljs-string\">main]</span>\n  <span class=\"hljs-attr\">workflow_dispatch:</span>\n<span class=\"hljs-attr\">concurrency:</span>\n  <span class=\"hljs-attr\">group:</span> <span class=\"hljs-string\">pages</span>\n  <span class=\"hljs-attr\">cancel-in-progress:</span> <span class=\"hljs-literal\">true</span>\n<span class=\"hljs-attr\">jobs:</span>\n  <span class=\"hljs-attr\">build:</span>\n    <span class=\"hljs-attr\">runs-on:</span> <span class=\"hljs-string\">ubuntu-latest</span>\n    <span class=\"hljs-attr\">steps:</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">Checkout</span> <span class=\"hljs-string\">source</span>\n        <span class=\"hljs-attr\">uses:</span> <span class=\"hljs-string\">actions/checkout@v7</span>\n      <span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">Build</span> <span class=\"hljs-string\">site</span>\n        <span class=\"hljs-attr\">uses:</span> <span class=\"hljs-string\">Cecilapp/Action@v4</span>\n  <span class=\"hljs-attr\">deploy:</span>\n    <span class=\"hljs-attr\">needs:</span> <span class=\"hljs-string\">build</span>\n    <span class=\"hljs-attr\">permissions:</span>\n      <span class=\"hljs-attr\">pages:</span> <span class=\"hljs-string\">write</span>\n      <span class=\"hljs-attr\">id-token:</span> <span class=\"hljs-string\">write</span>\n    <span class=\"hljs-attr\">environment:</span>\n      <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">github-pages</span>\n      <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>\n    <span class=\"hljs-attr\">runs-on:</span> <span class=\"hljs-string\">ubuntu-latest</span>\n    <span class=\"hljs-attr\">steps:</span>\n      <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>\n        <span class=\"hljs-attr\">id:</span> <span class=\"hljs-string\">deployment</span>\n        <span class=\"hljs-attr\">uses:</span> <span class=\"hljs-string\">actions/deploy-pages@v5</span></code></pre>\n<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>\n<h2 id=\"base-url\">Base URL<a class=\"heading-anchor\" href=\"#base-url\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<h2 id=\"customize-the-build\">Customize the build<a class=\"heading-anchor\" href=\"#customize-the-build\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>The action accepts the following optional inputs:</p>\n<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>\n        <span class=\"hljs-attr\">uses:</span> <span class=\"hljs-string\">Cecilapp/Action@v4</span>\n        <span class=\"hljs-attr\">with:</span>\n          <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>\n          <span class=\"hljs-attr\">version:</span> <span class=\"hljs-string\">'9.13.0'</span>      <span class=\"hljs-comment\"># Cecil version (latest by default)</span>\n          <span class=\"hljs-attr\">install_themes:</span> <span class=\"hljs-string\">'no'</span>   <span class=\"hljs-comment\"># skip themes installation (`yes` by default)</span>\n          <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>\n<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>\n<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://cloudflare.cecil.app/documentation/deploy/continuous-deployment/#github-pages\">GitHub Pages deployment documentation</a>, and the list of <a href=\"https://cloudflare.cecil.app/documentation/commands/build/\">build options</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/output-rss-json-feed/",
      "url": "https://cloudflare.cecil.app/how-to/output-rss-json-feed/",
      "title": "Publish an RSS or JSON feed",
      "summary": "Publish RSS, Atom or JSON feeds of your Cecil site with output formats and built-in templates.",
      "date_published": "2026-10-06T00:00:00+00:00",
      "date_modified": "2026-10-18T00:00:00+00:00","content_text": "Cecil renders feeds with output formats: by default, the home page, sections and taxonomy terms are already published in HTML and Atom (e.g. \/atom.xml, \/blog\/atom.xml). Add the rss or jsonfeed formats to publish RSS 2.0 or JSON Feed files too.\nEnable feeds for all list pages\nSet the formats applied to each page type with output.pagetypeformats:\noutput:\n  pagetypeformats:\n    homepage: [html, atom, rss, jsonfeed]\n    section: [html, atom, rss, jsonfeed]\nCecil now generates rss.xml and feed.json next to each index.html of the home page and sections (e.g. \/blog\/rss.xml, \/blog\/feed.json).\nThe list replaces the default formats: keep html and atom in it. To only add formats to the defaults, use a map of booleans instead:\noutput:\n  pagetypeformats:\n    homepage: {rss: true, jsonfeed: true}\n    section: {rss: true, jsonfeed: true}\nSee lists, output.pagetypeformats and the list of default formats.\nEnable a feed for a single section\nTo publish a feed only for one section, use the output variable in the front matter of the section index page. It replaces the default formats of the section, so keep atom in the list if you still want the Atom feed:\n---\ntitle: Blog\noutput: [html, atom, rss]\n---\nAdvertise the feed\nIf your templates include the metatags partial (see the metatags configuration), &lt;link rel=\"alternate\"&gt; tags pointing to the feeds of the current page are added automatically in the &lt;head&gt;.\nOtherwise, add the link yourself with the url() function and its format option:\n&lt;link rel=\"alternate\" type=\"application\/rss+xml\" title=\"{{ site.title }}\" href=\"{{ url(page, {canonical: true, format: 'rss'}) }}\"&gt;\nCustomize the feed template\nFeeds are rendered by the built-in templates _default\/list.rss.twig, _default\/list.atom.twig and _default\/list.jsonfeed.twig. Following the lookup rules, create layouts\/list.rss.twig (home page and sections) or layouts\/blog\/list.rss.twig (blog section only) to override them.\nYou can extend the built-in template and redefine only the item block, for example to publish an excerpt instead of the full content:\n{% extends '_default\/list.rss.twig' %}\n\n{% block item %}\n      &lt;guid&gt;{{ url(item, {canonical: true}) }}&lt;\/guid&gt;\n      &lt;title&gt;{{ item.title|e }}&lt;\/title&gt;\n      &lt;pubDate&gt;{{ item.date|date('r') }}&lt;\/pubDate&gt;\n      &lt;link&gt;{{ url(item, {canonical: true}) }}&lt;\/link&gt;\n      &lt;description&gt;&lt;![CDATA[{{ item.content|excerpt_html }}]]&gt;&lt;\/description&gt;\n{% endblock %}\nSet baseurl in cecil.yml: feeds use absolute URLs.\nThe RSS feed can also be styled in browsers by enabling the xsl\/rss default page:\npages:\n  default:\n    xsl\/rss:\n      published: true",
      "content_html": "<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>\n<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>\n<p>Set the formats applied to each page type with <code translate=\"no\">output.pagetypeformats</code>:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">output:</span>\n  <span class=\"hljs-attr\">pagetypeformats:</span>\n    <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>\n    <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>\n<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>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">output:</span>\n  <span class=\"hljs-attr\">pagetypeformats:</span>\n    <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>\n    <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>\n<aside class=\"note note-info\"><p>See <a href=\"https://cloudflare.cecil.app/documentation/configuration/#lists\">lists</a>, <a href=\"https://cloudflare.cecil.app/documentation/configuration/output/#output-pagetypeformats\"><code translate=\"no\">output.pagetypeformats</code></a> and the list of <a href=\"https://cloudflare.cecil.app/documentation/configuration/output/#default-formats\">default formats</a>.</p></aside>\n<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>\n<p>To publish a feed only for one section, use the <a href=\"https://cloudflare.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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Blog</span>\n<span class=\"hljs-attr\">output:</span> <span class=\"hljs-string\">[html,</span> <span class=\"hljs-string\">atom,</span> <span class=\"hljs-string\">rss]</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<h2 id=\"advertise-the-feed\">Advertise the feed<a class=\"heading-anchor\" href=\"#advertise-the-feed\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>If your templates include the <a href=\"https://cloudflare.cecil.app/how-to/templates-metatags/\">metatags partial</a> (see the <a href=\"https://cloudflare.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>\n<p>Otherwise, add the link yourself with the <code translate=\"no\">url()</code> function and its <code translate=\"no\">format</code> option:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">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>\n<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>\n<p>Feeds are rendered by the <a href=\"https://cloudflare.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://cloudflare.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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">extends</span></span> '_default/list.rss.twig' %}</span><span class=\"xml\">\n\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">block</span></span> item %}</span><span class=\"xml\">\n      <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>\n      <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>\n      <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>\n      <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>\n      <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>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endblock</span></span> %}</span></code></pre>\n<aside class=\"note note-tip\"><p>Set <a href=\"https://cloudflare.cecil.app/documentation/configuration/site/#baseurl\"><code translate=\"no\">baseurl</code></a> in <code translate=\"no\">cecil.yml</code>: feeds use absolute URLs.</p>\n<p>The RSS feed can also be styled in browsers by enabling the <code translate=\"no\">xsl/rss</code> <a href=\"https://cloudflare.cecil.app/documentation/configuration/pages/#pages-default\">default page</a>:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">default:</span>\n    <span class=\"hljs-attr\">xsl/rss:</span>\n      <span class=\"hljs-attr\">published:</span> <span class=\"hljs-literal\">true</span></code></pre></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/templates-pagination/",
      "url": "https://cloudflare.cecil.app/how-to/templates-pagination/",
      "title": "Paginate a list of pages",
      "summary": "Split long lists of pages (blog, sections, taxonomies) into several pages with Cecil pagination.",
      "date_published": "2026-10-05T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "When a section contains many pages, Cecil can split its list into several pages (e.g. \/blog\/, \/blog\/page\/2\/, \/blog\/page\/3\/, etc.) and give you a paginator to build the navigation links.\nConfigure pagination\nPagination is enabled by default for list pages (homepage, section and term), with 5 entries per page. Change it in cecil.yml:\npages:\n  pagination:\n    max: 10    # maximum number of entries per page\n    path: page # path of the paginated pages\nOverride it for a section\nSet the pagination variable in the front matter of the section index file (e.g. pages\/blog\/index.md):\n---\ntitle: Blog\npagination:\n  max: 20\n---\nOr disable it for this section only:\n---\npagination: false\n---\nDisplay the paginated pages\nThe paginator only exists when the list contains more pages than max. When pagination is disabled, or when all the pages fit on a single page, page.paginator is empty.\nIn the list template (e.g. layouts\/blog\/list.html.twig), loop over page.paginator.pages and fall back to page.pages.showable when there is no paginator:\n{% for p in page.paginator.pages ?? page.pages.showable %}\n  &lt;article&gt;\n    &lt;h2&gt;&lt;a href=\"{{ url(p) }}\"&gt;{{ p.title }}&lt;\/a&gt;&lt;\/h2&gt;\n    &lt;time datetime=\"{{ p.date|date('c') }}\"&gt;{{ p.date|date('j M Y') }}&lt;\/time&gt;\n  &lt;\/article&gt;\n{% endfor %}\nAdd navigation links\nPaginator links are page IDs, so use the url() function to create working links. The {% if page.paginator %} test hides the navigation when there is no paginator:\n{% if page.paginator %}\n&lt;nav&gt;\n  {% if page.paginator.links.prev is defined %}\n  &lt;a href=\"{{ url(page.paginator.links.prev) }}\" rel=\"prev\"&gt;Previous&lt;\/a&gt;\n  {% endif %}\n  &lt;span&gt;Page {{ page.paginator.current }} of {{ page.paginator.count }}&lt;\/span&gt;\n  {% if page.paginator.links.next is defined %}\n  &lt;a href=\"{{ url(page.paginator.links.next) }}\" rel=\"next\"&gt;Next&lt;\/a&gt;\n  {% endif %}\n&lt;\/nav&gt;\n{% endif %}\nTo list every page number, iterate from 1 to page.paginator.count:\n{% if page.paginator %}\n&lt;nav&gt;\n  {% for i in 1..page.paginator.count %}\n    {% if i == page.paginator.current %}\n  &lt;span aria-current=\"page\"&gt;{{ i }}&lt;\/span&gt;\n    {% elseif i == 1 %}\n  &lt;a href=\"{{ url(page.paginator.links.first) }}\"&gt;{{ i }}&lt;\/a&gt;\n    {% else %}\n  &lt;a href=\"{{ url(page.paginator.links.path ~ '\/' ~ i) }}\"&gt;{{ i }}&lt;\/a&gt;\n    {% endif %}\n  {% endfor %}\n&lt;\/nav&gt;\n{% endif %}\nSee the documentation of the page.paginator variable, the pagination configuration and the section pagination variable.",
      "content_html": "<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>\n<h2 id=\"configure-pagination\">Configure pagination<a class=\"heading-anchor\" href=\"#configure-pagination\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">pagination:</span>\n    <span class=\"hljs-attr\">max:</span> <span class=\"hljs-number\">10</span>    <span class=\"hljs-comment\"># maximum number of entries per page</span>\n    <span class=\"hljs-attr\">path:</span> <span class=\"hljs-string\">page</span> <span class=\"hljs-comment\"># path of the paginated pages</span></code></pre>\n<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>\n<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>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">Blog</span>\n<span class=\"hljs-attr\">pagination:</span>\n  <span class=\"hljs-attr\">max:</span> <span class=\"hljs-number\">20</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<p>Or disable it for this section only:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">pagination:</span> <span class=\"hljs-literal\">false</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<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>\n<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>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> p in page.paginator.pages ?? page.pages.showable %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">article</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h2</span>&gt;</span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(p) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ p.title }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">h2</span>&gt;</span>\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">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>\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">article</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre>\n<h2 id=\"add-navigation-links\">Add navigation links<a class=\"heading-anchor\" href=\"#add-navigation-links\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.paginator %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">nav</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.paginator.links.prev is defined %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.paginator.links.prev) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <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>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">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>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.paginator.links.next is defined %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.paginator.links.next) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span> <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>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">nav</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<p>To list every page number, iterate from <code translate=\"no\">1</code> to <code translate=\"no\">page.paginator.count</code>:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> page.paginator %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">nav</span>&gt;</span>\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> i in 1..page.paginator.count %}</span><span class=\"xml\">\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">if</span></span> i == page.paginator.current %}</span><span class=\"xml\">\n  <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>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">elseif</span> i == 1 %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.paginator.links.first) }}</span><span class=\"xml\"><span class=\"hljs-tag\"><span class=\"hljs-string\">\"</span>&gt;</span></span><span class=\"hljs-template-variable\">{{ i }}</span><span class=\"xml\"><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">a</span>&gt;</span>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">else</span> %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(page.paginator.links.path ~ '/' ~ 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>\n    </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span><span class=\"xml\">\n  </span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span><span class=\"xml\">\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">nav</span>&gt;</span>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endif</span></span> %}</span></code></pre>\n<aside class=\"note note-info\"><p>See the documentation of the <a href=\"https://cloudflare.cecil.app/documentation/templates/variables/#page-paginator\"><code translate=\"no\">page.paginator</code> variable</a>, the <a href=\"https://cloudflare.cecil.app/documentation/configuration/pages/#pages-pagination\">pagination configuration</a> and the <a href=\"https://cloudflare.cecil.app/documentation/content/pages/#pagination\">section <code translate=\"no\">pagination</code> variable</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/content-multilingual/",
      "url": "https://cloudflare.cecil.app/how-to/content-multilingual/",
      "title": "Translate a site into multiple languages",
      "summary": "Translate pages, configuration and template strings of a Cecil site into multiple languages.",
      "date_published": "2026-10-04T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "Cecil handles multilingual sites natively: declare the languages, add translated pages, then link them together and translate your templates.\nDeclare languages\nDefine the main language and the list of available languages in cecil.yml:\nlanguage: en\nlanguages:\n  - code: en\n    name: English\n    locale: en_US\n  - code: fr\n    name: Français\n    locale: fr_FR\n    config:\n      title: \"Mon site en français\"\nOptions stored under the config key of a language override the global ones (here the site title).\nTranslate a page\nDuplicate the reference page and suffix its file name with the language code:\npages\/\n├─ about.md    # the reference page\n└─ about.fr.md # the French version\nUse the slug variable to translate the URL of the page:\n---\ntitle: À propos\nslug: a-propos\n---\nabout.md is published to \/about\/ and about.fr.md to \/fr\/a-propos\/.\nTo create a page that only exists in another language (not a translation), set language: fr in its front matter.\nLink translated pages\nEach page exposes its translations with page.translations. Add a language switcher to your template:\n{% for p in page.translations %}\n  &lt;a href=\"{{ url(p) }}\" hreflang=\"{{ p.language }}\"&gt;{{ site.language.name(p.language) }}&lt;\/a&gt;\n{% endfor %}\nYou can also include the built-in partial: {{ include('partials\/languages.html.twig') }}.\nTranslations are linked through the langref variable, which is derived from the file path by default. To link pages whose file paths differ, set the same langref in their front matter (e.g. langref: about).\nTranslate template strings\nWrap texts with the trans tag or filter:\n{% trans %}Read more{% endtrans %}\n{{ 'Read more'|trans }}\nThen add a translation file named after the language locale in the translations directory:\n# translations\/messages.fr_FR.yaml\nRead more: Lire la suite\nExtract the strings of your templates with:\nphp cecil.phar util:translations:extract --locale=fr_FR --save\nSee the documentation of multilingual content, languages configuration and templates localization.",
      "content_html": "<p>Cecil handles multilingual sites natively: declare the languages, add translated pages, then link them together and translate your templates.</p>\n<h2 id=\"declare-languages\">Declare languages<a class=\"heading-anchor\" href=\"#declare-languages\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Define the main language and the list of available languages in <code translate=\"no\">cecil.yml</code>:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">language:</span> <span class=\"hljs-string\">en</span>\n<span class=\"hljs-attr\">languages:</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">code:</span> <span class=\"hljs-string\">en</span>\n    <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">English</span>\n    <span class=\"hljs-attr\">locale:</span> <span class=\"hljs-string\">en_US</span>\n  <span class=\"hljs-bullet\">-</span> <span class=\"hljs-attr\">code:</span> <span class=\"hljs-string\">fr</span>\n    <span class=\"hljs-attr\">name:</span> <span class=\"hljs-string\">Français</span>\n    <span class=\"hljs-attr\">locale:</span> <span class=\"hljs-string\">fr_FR</span>\n    <span class=\"hljs-attr\">config:</span>\n      <span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">\"Mon site en français\"</span></code></pre>\n<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>\n<h2 id=\"translate-a-page\">Translate a page<a class=\"heading-anchor\" href=\"#translate-a-page\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Duplicate the reference page and suffix its file name with the language code:</p>\n<pre data-lang=\"plaintext\"><code class=\"language-plaintext hljs plaintext\" translate=\"no\">pages/\n├─ about.md    # the reference page\n└─ about.fr.md # the French version</code></pre>\n<p>Use the <code translate=\"no\">slug</code> variable to translate the URL of the page:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-meta\">---</span>\n<span class=\"hljs-attr\">title:</span> <span class=\"hljs-string\">À</span> <span class=\"hljs-string\">propos</span>\n<span class=\"hljs-attr\">slug:</span> <span class=\"hljs-string\">a-propos</span>\n<span class=\"hljs-meta\">---</span></code></pre>\n<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>\n<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>\n<h2 id=\"link-translated-pages\">Link translated pages<a class=\"heading-anchor\" href=\"#link-translated-pages\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Each page exposes its translations with <code translate=\"no\">page.translations</code>. Add a language switcher to your template:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">for</span></span> p in page.translations %}</span><span class=\"xml\">\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a</span> <span class=\"hljs-attr\">href</span>=<span class=\"hljs-string\">\"</span></span></span><span class=\"hljs-template-variable\">{{ url(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>\n</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\"><span class=\"hljs-keyword\">endfor</span></span> %}</span></code></pre>\n<p>You can also include the built-in partial: <code translate=\"no\">{{ include('partials/languages.html.twig') }}</code>.</p>\n<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>\n<h2 id=\"translate-template-strings\">Translate template strings<a class=\"heading-anchor\" href=\"#translate-template-strings\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Wrap texts with the <code translate=\"no\">trans</code> tag or filter:</p>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">trans</span> %}</span><span class=\"xml\">Read more</span><span class=\"hljs-template-tag\">{% <span class=\"hljs-name\">endtrans</span> %}</span><span class=\"xml\">\n</span><span class=\"hljs-template-variable\">{{ 'Read more'|trans }}</span></code></pre>\n<p>Then add a translation file named after the language locale in the <code translate=\"no\">translations</code> directory:</p>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-comment\"># translations/messages.fr_FR.yaml</span>\n<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>\n<p>Extract the strings of your templates with:</p>\n<pre data-lang=\"bash\"><code class=\"language-bash hljs bash\" translate=\"no\">php cecil.phar util:translations:extract --locale=fr_FR --save</code></pre>\n<aside class=\"note note-info\"><p>See the documentation of <a href=\"https://cloudflare.cecil.app/documentation/content/multilingual/\">multilingual content</a>, <a href=\"https://cloudflare.cecil.app/documentation/configuration/languages/#languages\">languages configuration</a> and <a href=\"https://cloudflare.cecil.app/documentation/templates/localization/\">templates localization</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/templates-metatags/",
      "url": "https://cloudflare.cecil.app/how-to/templates-metatags/",
      "title": "Apply SEO features in templates",
      "summary": "Add Cecil SEO features to templates with the metatags partial.",
      "date_published": "2026-06-09T00:00:00+00:00",
      "date_modified": "2026-10-18T00:00:00+00:00","content_text": "Cecil exposes its SEO features through the partials\/metatags.html.twig template. Include it in the &lt;head&gt; of your base template so every page automatically gets title, meta tags, canonical links, and social cards. Structured data (JSON-LD) can be enabled too, with the metatags.data option set to true.\n&lt;html lang=\"{{ site.language }}\"&gt;\n  &lt;head&gt;\n    &lt;meta charset=\"utf-8\"&gt;\n    {{ include('partials\/metatags.html.twig') }}\n  &lt;\/head&gt;\n  &lt;body&gt;\n    ...\n  &lt;\/body&gt;\n&lt;\/html&gt;\nThe partial already outputs the &lt;title&gt; element: do not add your own.\nThe partial reads page front matter first, then falls back to site configuration when needed. See the metatags configuration documentation for all available options.\nIf you need to override the default title or image, pass values directly to the partial (image accepts a file path or an asset):\n{{ include('partials\/metatags.html.twig', {title: 'Custom title', image: 'images\/social-card.png'}) }}",
      "content_html": "<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">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>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">head</span>&gt;</span>\n    <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>\n    </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\">\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">head</span>&gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">body</span>&gt;</span>\n    ...\n  <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">body</span>&gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">html</span>&gt;</span></span></code></pre>\n<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>\n<p>The partial reads page front matter first, then falls back to site configuration when needed. See the <a href=\"https://cloudflare.cecil.app/documentation/configuration/site/#metatags\">metatags configuration documentation</a> for all available options.</p>\n<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>\n<pre data-lang=\"twig\"><code class=\"language-twig hljs twig\" translate=\"no\"><span class=\"hljs-template-variable\">{{ <span class=\"hljs-name\">include</span><span class=\"hljs-params\">('partials/metatags.html.twig', {title: 'Custom title', image: 'images/social-card.png'})</span> }}</span></code></pre>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/markdown-performance-images/",
      "url": "https://cloudflare.cecil.app/how-to/markdown-performance-images/",
      "title": "Optimize images in Markdown",
      "summary": "Optimize Markdown images in Cecil with responsive sizes, formats, and lazy loading.",
      "date_published": "2025-06-01T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "One of the most effective ways to improve the performance of your website is to optimize images.\nCecil can automatically apply the following optimizations to images in Markdown (see the configuration below):\n\nDimensions: image dimensions are set to ensure proper layout and prevent layout shifts\nCompression: the image is compressed to reduce file size without significant loss of quality (requires assets.images.optimize: true and the optimization tools, such as JpegOptim or Optipng, installed)\nImage formats: Cecil generates AVIF and WebP formats for the image\nResponsive images: Cecil generates two different sizes of the image (based on the configuration) to serve the appropriate size for different devices\nLazy loading: the image is set to load lazily, meaning it will only load when it comes into the viewport\nDecoding: the image is set to decode asynchronously, improving the initial page load time\nPlaceholder: a color placeholder is used while the image is loading\n\nSee the documentation for more details on the global assets configuration and the pages configuration.\nExample\nBelow is an example with a 1920 × 1276 pixels JPEG image.\n![A star forming region in the sky](..\/..\/assets\/images\/examples\/arnaud-girault-IjEtFjxXweE-unsplash.jpg \"Photo by Arnaud Girault\"){placeholder=color}\n\n\n\n\n\n\nPhoto by Arnaud Girault\n\nConfiguration\n# global assets configuration\nassets:\n  images:\n    optimize: true\n    responsive:\n      widths: [768, 1024]\n# configuration of images in Markdown\npages:\n  body:\n    images:\n      formats: [avif, webp]\n      responsive: true\n      lazy: true\n      decoding: true\n      placeholder: color\nGenerated HTML\n&lt;picture title=\"Photo by Arnaud Girault\"&gt;\n  &lt;source\n    type=\"image\/avif\"\n    srcset=\"\/thumbnails\/768x\/images\/examples\/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 768w,\n            \/thumbnails\/1024x\/images\/examples\/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 1024w\"\n    width=\"1024\"\n    height=\"681\"\n    sizes=\"100vw\"\n  &gt;\n  &lt;source\n    type=\"image\/webp\"\n    srcset=\"\/thumbnails\/768x\/images\/examples\/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 768w,\n            \/thumbnails\/1024x\/images\/examples\/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 1024w\"\n    width=\"1024\"\n    height=\"681\"\n    sizes=\"100vw\"\n  &gt;\n  &lt;img src=\"\/thumbnails\/1024x\/images\/examples\/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg\"\n    alt=\"A star forming region in the sky\"\n    loading=\"lazy\"\n    decoding=\"async\"\n    width=\"1024\"\n    height=\"681\"\n    style=\";max-width:100%;height:auto;background-color:rgb(29 41 43);\"\n    srcset=\"\/thumbnails\/768x\/images\/examples\/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 768w,\n            \/thumbnails\/1024x\/images\/examples\/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 1024w\"\n    sizes=\"100vw\"\n  &gt;\n&lt;\/picture&gt;",
      "content_html": "<p>One of the most effective ways to improve the performance of your website is to optimize images.</p>\n<p>Cecil can automatically apply the following optimizations to images in Markdown (see the configuration below):</p>\n<ol>\n<li><strong>Dimensions</strong>: image dimensions are set to ensure proper layout and prevent layout shifts</li>\n<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>\n<li><strong>Image formats</strong>: Cecil generates AVIF and WebP formats for the image</li>\n<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>\n<li><strong>Lazy loading</strong>: the image is set to load lazily, meaning it will only load when it comes into the viewport</li>\n<li><strong>Decoding</strong>: the image is set to decode asynchronously, improving the initial page load time</li>\n<li><strong>Placeholder</strong>: a color placeholder is used while the image is loading</li>\n</ol>\n<aside class=\"note note-info\"><p>See the documentation for more details on the <a href=\"https://cloudflare.cecil.app/documentation/configuration/assets/#assets-images\">global assets configuration</a> and the <a href=\"https://cloudflare.cecil.app/documentation/configuration/pages/#pages-body\">pages configuration</a>.</p></aside>\n<h2 id=\"example\">Example<a class=\"heading-anchor\" href=\"#example\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Below is an example with a 1920 × 1276 pixels JPEG image.</p>\n<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>\n<figure>\n<picture title=\"Photo by Arnaud Girault\">\n<source type=\"image/avif\" srcset=\"https://cloudflare.cecil.app/thumbnails/480x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 480w, https://cloudflare.cecil.app/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 768w, https://cloudflare.cecil.app/thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 1024w, https://cloudflare.cecil.app/thumbnails/1536x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 1536w\" width=\"1536\" height=\"1021\" sizes=\"100vw\">\n<source type=\"image/webp\" srcset=\"https://cloudflare.cecil.app/thumbnails/480x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 480w, https://cloudflare.cecil.app/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 768w, https://cloudflare.cecil.app/thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 1024w, https://cloudflare.cecil.app/thumbnails/1536x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 1536w\" width=\"1536\" height=\"1021\" sizes=\"100vw\">\n<img src=\"https://cloudflare.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(32 42 42);\" srcset=\"https://cloudflare.cecil.app/thumbnails/480x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 480w, https://cloudflare.cecil.app/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 768w, https://cloudflare.cecil.app/thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 1024w, https://cloudflare.cecil.app/thumbnails/1536x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 1536w\" sizes=\"100vw\">\n</picture>\n<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>\n</figure>\n<h3 id=\"configuration\">Configuration<a class=\"heading-anchor\" href=\"#configuration\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-comment\"># global assets configuration</span>\n<span class=\"hljs-attr\">assets:</span>\n  <span class=\"hljs-attr\">images:</span>\n    <span class=\"hljs-attr\">optimize:</span> <span class=\"hljs-literal\">true</span>\n    <span class=\"hljs-attr\">responsive:</span>\n      <span class=\"hljs-attr\">widths:</span> <span class=\"hljs-string\">[768,</span> <span class=\"hljs-number\">1024</span><span class=\"hljs-string\">]</span>\n<span class=\"hljs-comment\"># configuration of images in Markdown</span>\n<span class=\"hljs-attr\">pages:</span>\n  <span class=\"hljs-attr\">body:</span>\n    <span class=\"hljs-attr\">images:</span>\n      <span class=\"hljs-attr\">formats:</span> <span class=\"hljs-string\">[avif,</span> <span class=\"hljs-string\">webp]</span>\n      <span class=\"hljs-attr\">responsive:</span> <span class=\"hljs-literal\">true</span>\n      <span class=\"hljs-attr\">lazy:</span> <span class=\"hljs-literal\">true</span>\n      <span class=\"hljs-attr\">decoding:</span> <span class=\"hljs-literal\">true</span>\n      <span class=\"hljs-attr\">placeholder:</span> <span class=\"hljs-string\">color</span></code></pre>\n<h3 id=\"generated-html\">Generated HTML<a class=\"heading-anchor\" href=\"#generated-html\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<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>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">source</span>\n    <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"image/avif\"</span>\n    <span class=\"hljs-attr\">srcset</span>=<span class=\"hljs-string\">\"/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 768w,\n            /thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.avif 1024w\"</span>\n    <span class=\"hljs-attr\">width</span>=<span class=\"hljs-string\">\"1024\"</span>\n    <span class=\"hljs-attr\">height</span>=<span class=\"hljs-string\">\"681\"</span>\n    <span class=\"hljs-attr\">sizes</span>=<span class=\"hljs-string\">\"100vw\"</span>\n  &gt;</span>\n  <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">source</span>\n    <span class=\"hljs-attr\">type</span>=<span class=\"hljs-string\">\"image/webp\"</span>\n    <span class=\"hljs-attr\">srcset</span>=<span class=\"hljs-string\">\"/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 768w,\n            /thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.webp 1024w\"</span>\n    <span class=\"hljs-attr\">width</span>=<span class=\"hljs-string\">\"1024\"</span>\n    <span class=\"hljs-attr\">height</span>=<span class=\"hljs-string\">\"681\"</span>\n    <span class=\"hljs-attr\">sizes</span>=<span class=\"hljs-string\">\"100vw\"</span>\n  &gt;</span>\n  <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>\n    <span class=\"hljs-attr\">alt</span>=<span class=\"hljs-string\">\"A star forming region in the sky\"</span>\n    <span class=\"hljs-attr\">loading</span>=<span class=\"hljs-string\">\"lazy\"</span>\n    <span class=\"hljs-attr\">decoding</span>=<span class=\"hljs-string\">\"async\"</span>\n    <span class=\"hljs-attr\">width</span>=<span class=\"hljs-string\">\"1024\"</span>\n    <span class=\"hljs-attr\">height</span>=<span class=\"hljs-string\">\"681\"</span>\n    <span class=\"hljs-attr\">style</span>=<span class=\"hljs-string\">\";max-width:100%;height:auto;background-color:rgb(29 41 43);\"</span>\n    <span class=\"hljs-attr\">srcset</span>=<span class=\"hljs-string\">\"/thumbnails/768x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 768w,\n            /thumbnails/1024x/images/examples/arnaud-girault-IjEtFjxXweE-unsplash.9f9b5448197aded5325854d4f3c79652.jpg 1024w\"</span>\n    <span class=\"hljs-attr\">sizes</span>=<span class=\"hljs-string\">\"100vw\"</span>\n  &gt;</span>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">picture</span>&gt;</span></code></pre>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/templates-image-formats/",
      "url": "https://cloudflare.cecil.app/how-to/templates-image-formats/",
      "title": "Generate multiple formats of an image in templates",
      "summary": "Generate AVIF and WebP image formats in Cecil templates.",
      "date_published": "2025-06-01T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "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:\n{{ html(asset('image.jpg'), attributes={alt: 'Alternative description'}, options={formats: ['avif', 'webp']}) }}\nAVIF 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.\nAlternative formats can be enabled for every image rendered with html through the layouts.images.formats option.\nExample\nBelow is an example of how to generate AVIF and WebP formats of an image:\n{{ html(asset('cecil-logo.png'), attributes={alt: 'Cecil logo'}, options={formats: ['avif', 'webp']}) }}\nGenerated HTML\n&lt;picture&gt;\n  &lt;source type=\"image\/avif\" srcset=\"\/cecil-logo.c1af8a129a0cde81f9b94ffbf452e10b.avif\"&gt;\n  &lt;source type=\"image\/webp\" srcset=\"\/cecil-logo.c1af8a129a0cde81f9b94ffbf452e10b.webp\"&gt;\n  &lt;img src=\"\/cecil-logo.c1af8a129a0cde81f9b94ffbf452e10b.png\" alt=\"Cecil logo\" width=\"250\" height=\"250\"&gt;\n&lt;\/picture&gt;\nSee the documentation of the html function.",
      "content_html": "<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>\n<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>\n<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>\n<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://cloudflare.cecil.app/documentation/configuration/layouts/#layouts-images\"><code translate=\"no\">layouts.images.formats</code> option</a>.</p></aside>\n<h2 id=\"example\">Example<a class=\"heading-anchor\" href=\"#example\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Below is an example of how to generate AVIF and WebP formats of an image:</p>\n<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>\n<h3 id=\"generated-html\">Generated HTML<a class=\"heading-anchor\" href=\"#generated-html\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<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>\n  <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>\n  <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>\n  <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>\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">picture</span>&gt;</span></code></pre>\n<aside class=\"note note-info\"><p>See the documentation of the <a href=\"https://cloudflare.cecil.app/documentation/templates/reference/functions/#html\"><code translate=\"no\">html</code> function</a>.</p></aside>",
      "language": "en"
    },
    {
      "id": "https://cloudflare.cecil.app/how-to/templates-responsive-images/",
      "url": "https://cloudflare.cecil.app/how-to/templates-responsive-images/",
      "title": "Render responsive images in templates",
      "summary": "Render responsive images in Cecil templates with the html function.",
      "date_published": "2024-01-18T00:00:00+00:00",
      "date_modified": "2026-10-16T00:00:00+00:00","content_text": "The easiest way to render responsive images in templates is with the html function:\n{{ html(asset('image.jpg'), attributes={alt: 'Alternative description'}, options={responsive: true}) }}\nThe default width values of the generated images are 480, 640, 768, 1024, 1366, 1600 and 1920. They can be modified in the assets section of the configuration.\nResponsive images can be enabled for every image rendered with html through the layouts.images.responsive option. Use responsive: 'density' to generate pixel density variants (1x, 2x, etc.) instead of widths.\nExample\nBelow is an example with a 1000×1000 pixel PNG image:\n{{ html(asset('cecil-logo-1000.png'), attributes={alt: 'Cecil logo'}, options={responsive: true}) }}\nConfiguration\nassets:\n  images:\n    responsive:\n      widths: [768, 1024]\nGenerated HTML\nReformatted for readability:\n&lt;img\n  src=\"\/cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png\"\n  alt=\"Cecil logo\"\n  srcset=\"\/thumbnails\/768\/cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png 768w,\n          \/cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png 1000w\"\n  sizes=\"100vw\"\n  width=\"1000\"\n  height=\"1000\"\n&gt;",
      "content_html": "<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://cloudflare.cecil.app/documentation/templates/reference/functions/#html\"><code translate=\"no\">html</code> function</a>:</p>\n<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>\n<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://cloudflare.cecil.app/documentation/configuration/assets/#assets-images\">configuration</a>.</p></aside>\n<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://cloudflare.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>\n<h2 id=\"example\">Example<a class=\"heading-anchor\" href=\"#example\" aria-hidden=\"true\" tabindex=\"-1\"></a></h2>\n<p>Below is an example with a 1000×1000 pixel PNG image:</p>\n<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>\n<h3 id=\"configuration\">Configuration<a class=\"heading-anchor\" href=\"#configuration\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<pre data-lang=\"yaml\"><code class=\"language-yaml hljs yaml\" translate=\"no\"><span class=\"hljs-attr\">assets:</span>\n  <span class=\"hljs-attr\">images:</span>\n    <span class=\"hljs-attr\">responsive:</span>\n      <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>\n<h3 id=\"generated-html\">Generated HTML<a class=\"heading-anchor\" href=\"#generated-html\" aria-hidden=\"true\" tabindex=\"-1\"></a></h3>\n<p>Reformatted for readability:</p>\n<pre data-lang=\"html\"><code class=\"language-html hljs xml\" translate=\"no\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">img</span>\n  <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">\"/cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png\"</span>\n  <span class=\"hljs-attr\">alt</span>=<span class=\"hljs-string\">\"Cecil logo\"</span>\n  <span class=\"hljs-attr\">srcset</span>=<span class=\"hljs-string\">\"/thumbnails/768/cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png 768w,\n          /cecil-logo-1000.fbacb922cddbcdb7ca9a03a3ca3cf2ca.png 1000w\"</span>\n  <span class=\"hljs-attr\">sizes</span>=<span class=\"hljs-string\">\"100vw\"</span>\n  <span class=\"hljs-attr\">width</span>=<span class=\"hljs-string\">\"1000\"</span>\n  <span class=\"hljs-attr\">height</span>=<span class=\"hljs-string\">\"1000\"</span>\n&gt;</span></code></pre>",
      "language": "en"
    }
  ]
}
