Add collections dedicated to pdf template

This commit is contained in:
TheThomaas 2025-06-09 18:31:31 +02:00
parent 39a9ec10ca
commit 3d230cdd6a
2 changed files with 9 additions and 6 deletions

View file

@ -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);

View file

@ -25,13 +25,10 @@ links:
</ul>
</section>
<p>
The time is {{ "now" | date: "%Y-%m-%d %H:%M" }}
<p style="margin-bottom: 1ch;">{{ author.about }}</p>
</p>
{% 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 %}