From 03314d4c1cf6743a3cd122363b0e8bb5c40a7b81 Mon Sep 17 00:00:00 2001 From: TheThomaas Date: Thu, 24 Apr 2025 14:25:31 +0200 Subject: [PATCH] Add template for the pdf file --- eleventy.config.js | 1 + src/_includes/layouts/pdf.html | 217 +++++++++++++++++++++++++++++ src/pages/sections/download.liquid | 1 + src/pages/sections/hero.liquid | 1 + src/pdf.liquid | 26 ++++ 5 files changed, 246 insertions(+) create mode 100644 src/_includes/layouts/pdf.html create mode 100644 src/pdf.liquid diff --git a/eleventy.config.js b/eleventy.config.js index d918af2..6468c28 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -11,6 +11,7 @@ export default async function (eleventyConfig) { eleventyConfig.addPassthroughCopy({"./src/_includes/js/" : "/js"}); eleventyConfig.addLayoutAlias('base', 'layouts/base.html'); + eleventyConfig.addLayoutAlias('pdf', 'layouts/pdf.html'); eleventyConfig.addCollection("sections", (collectionApi) => { const sections = collectionApi.getFilteredByGlob("./src/pages/sections/**") diff --git a/src/_includes/layouts/pdf.html b/src/_includes/layouts/pdf.html new file mode 100644 index 0000000..dbc7dcb --- /dev/null +++ b/src/_includes/layouts/pdf.html @@ -0,0 +1,217 @@ + + + + + + {{ title }} + + + + +
+

{{ title }}

+ +
+ + {% block content %} + {{ content }} + {% endblock %} + +
+
+

Lorem

+
+
+ +
+ +
+
+

Lorem

+
+
+
+

Lorem ipsum

+

+ Lorem ipsum +

+
+ Lorem ipsum + 01/1999 - 02/1999 +
+
+ +
+

Lorem ipsum

+

+ Lorem ipsum +

+
+ Lorem ipsum + 01/1999 - 02/1999 +
+
+ +
+

Lorem ipsum

+

+ Lorem ipsum +

+
+ Lorem ipsum + 01/1999 - 02/1999 +
+
+ +
+ +
+
+

Lorem

+
+
+
+

Lorem ipsum 2

+

+ Lorem ipsum +

+
+ Lorem ipsum + 01/1999 - 02/1999 +
+
+ +
+ +
+
+

Lorem

+
+
+ +
+ + + + \ No newline at end of file diff --git a/src/pages/sections/download.liquid b/src/pages/sections/download.liquid index 5ac90e6..e454d8f 100644 --- a/src/pages/sections/download.liquid +++ b/src/pages/sections/download.liquid @@ -1,6 +1,7 @@ --- title: Téléchargement showTitle: false +excludeFromPdf: true order: 4 --- diff --git a/src/pages/sections/hero.liquid b/src/pages/sections/hero.liquid index 887610f..d2db8e3 100644 --- a/src/pages/sections/hero.liquid +++ b/src/pages/sections/hero.liquid @@ -2,6 +2,7 @@ title: A propos order: 0 template: 'hero' +excludeFromPdf: true eleventyComputed: description: "{{ author.about }}" displayedTitle: "Moi c'est {{ author.firstName }}
Et je suis {{ author.occupation }}" diff --git a/src/pdf.liquid b/src/pdf.liquid new file mode 100644 index 0000000..68c183a --- /dev/null +++ b/src/pdf.liquid @@ -0,0 +1,26 @@ +--- +layout: pdf +title: Test PDF +permalink: "pdf.pdf" +--- + +

Hello

+ +

+ +

+ +

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

+ +{% for section in collections.sections %} + {% if section.data.excludeFromPdf != true %} + {% if section.data.template == 'hero' %} + {% include 'hero' %} + {% else %} + {% include 'page' %} + {% endif %} + {% endif %} + {% endfor %} \ No newline at end of file