Get name of file from shortcode

I store my images in static/images/{name of post}/. How can I get the name of the file from the shortcode? Here’s how I’d like to run the shortcode:

{{< image name="note-01.png" >}}

Then, the shortcode runs the following:

<img src="/images/{name of post}/note-01.png" />

every page object has a file attribute .File

{{.File.BaseFileName}} should do the trick

Here’s the solution: {{- Page.File.TranslationBaseName -}}

nice, you got it

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.