From 421f2fa7b0a015bd955799c49b9440d5f563addd Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Sun, 22 Dec 2024 23:32:45 +0100 Subject: [PATCH] fix(shortcodes): allow parent bundle resource lookup on fig-img --- assets/sass/general.scss | 8 ++++++++ .../biere_la_majestueuse.jpg} | Bin .../association/{partenariat.md => partenariats.md} | 5 ++--- layouts/shortcodes/fig-img.html | 8 +++++++- 4 files changed, 17 insertions(+), 4 deletions(-) rename content/association/{imgs/biere-majestueuse.jpg => images/biere_la_majestueuse.jpg} (100%) rename content/association/{partenariat.md => partenariats.md} (97%) diff --git a/assets/sass/general.scss b/assets/sass/general.scss index dc8e3de..d5f617a 100644 --- a/assets/sass/general.scss +++ b/assets/sass/general.scss @@ -64,6 +64,14 @@ img { object-fit: contain; } +// Margin management +.no-margin { + margin-top: 0 !important; + margin-left: 0 !important; + margin-right: 0 !important; + margin-bottom: 0 !important; +} + /** General Layout **/ diff --git a/content/association/imgs/biere-majestueuse.jpg b/content/association/images/biere_la_majestueuse.jpg similarity index 100% rename from content/association/imgs/biere-majestueuse.jpg rename to content/association/images/biere_la_majestueuse.jpg diff --git a/content/association/partenariat.md b/content/association/partenariats.md similarity index 97% rename from content/association/partenariat.md rename to content/association/partenariats.md index e7a9952..a286da6 100644 --- a/content/association/partenariat.md +++ b/content/association/partenariats.md @@ -10,13 +10,12 @@ En 2023, une bière exclusive a été brassée par la Brasserie des Cottereaux e {{}} -![biere](/biere-majestueuse.jpg) - ## Miel À l’été 2024, 12 ruches ont été installées sur le coteau de la chapelle par l’apiculteur Samuel Fedorawiez. Le premier miel est attendu pour le printemps 2025, et une partie des ventes contribuera directement au financement de l’association. diff --git a/layouts/shortcodes/fig-img.html b/layouts/shortcodes/fig-img.html index b09eb42..169cbab 100644 --- a/layouts/shortcodes/fig-img.html +++ b/layouts/shortcodes/fig-img.html @@ -14,7 +14,13 @@ {{ if hasPrefix (.Get "src") "https://" }} {{ $permalink = .Get "src" }} {{ else }} - {{ $permalink = ((.Page.Resources.GetMatch (.Get "src")).Fill $options).Permalink }} + {{ $resource := .Page.Resources.GetMatch (.Get "src") }} + {{ if not $resource }} + {{ $resource = .Page.Parent.Resources.GetMatch (.Get "src") }} + {{- end -}} + {{ if $resource }} + {{ $permalink = ($resource.Fill $options).Permalink }} + {{- end -}} {{- end -}}