What I am trying to achieve is the display of an image as a background image.
The way it is handled currently is like so, in an html file in the layout folder
{{ range sort .Pages "Weight" }}
{{- $imagePermalink := "" }}
{{if .Params.images}}
{{- with partial "_funcs/get-page-images" . }}
{{- range . | first 1 }}
{{- $imagePermalink = .Permalink }}
{{- end }}
{{- end }}
<a href="{{ .Permalink }}" class="overview-card" style="background-image: url('{{ $imagePermalink }}')">
So in my front matter I can reference the image like this in my _index.md
---
title: "Getting Started"
date: "2024-04-12"
summary: "Essential information to help you begin your journey"
type: "chapter"
images: ["images/GettingStarted.jpg"]
weight: 1
---
the folder architecture being this one for this page, with the images in the images folder at the same level as the _index.md
But it only works when I am inside an _index.md. Letβs say that I want to achieve the same in another page, the Installation.md from the same directory above:
---
title: "Installation"
slug: "installation"
date: 2025-01-14
name: "Installation"
summary: Step-by-step instructions on how to install.
images: ["images/install.jpg"]
weight: 2
---
The problem is that the image is not displayed as it does not return me the correct link
I guess that depends on your _funcs/get-page-images partial. Which you donβt showβ¦ In general, itβs easier and speedier to get help here by posting a link to your repository so people can see everything β not only what you deem relevant.
In any case, checking out the difference between branch and leaf page bundles might be worth a try.
Also, the embedded partial that you are using was created to support other internal templates (opengraph, etc.). It was never intended to be used outside of that context, which is why it is not documented.