From 3d230cdd6a5cd70ecfd7c56b5ce5d3aed203a440 Mon Sep 17 00:00:00 2001 From: TheThomaas Date: Mon, 9 Jun 2025 18:31:31 +0200 Subject: [PATCH] Add collections dedicated to pdf template --- eleventy.config.js | 6 ++++++ src/pdf.liquid | 9 +++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/eleventy.config.js b/eleventy.config.js index 0308d5f..5d771fd 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -16,6 +16,12 @@ export default async function (eleventyConfig) { process.env.DEBUG && console.log(inspect(sections)); return sections; }); + eleventyConfig.addCollection("pdfSections", (collectionApi) => { + const sections = collectionApi.getFilteredByGlob("./src/pages/sections/**") + .sort((a, b) => (a.data?.pdf?.order ?? a.data.order) - (b.data?.pdf?.order ?? b.data.order)); + process.env.DEBUG && console.log(inspect(sections)); + return sections; + }); eleventyConfig.addCollection("projects", (collectionApi) => { const projects = collectionApi.getFilteredByGlob("./src/projects/**") .sort((a, b) => a.data.order - b.data.order); diff --git a/src/pdf.liquid b/src/pdf.liquid index c6a3e29..32afc4c 100644 --- a/src/pdf.liquid +++ b/src/pdf.liquid @@ -25,13 +25,10 @@ links: -

-The time is {{ "now" | date: "%Y-%m-%d %H:%M" }} +

{{ author.about }}

-

- -{% for section in collections.sections %} - {% if section.data.excludeFromPdf != true %} +{% for section in collections.pdfSections %} + {% if section.data.pdf.exclude != true %} {% assign items = collections[section.data.collection] %} {% include 'partials/components/pdf/section' %} {% endif %}