-
-
Notifications
You must be signed in to change notification settings - Fork 103
Description
Describe the bug
In media Snippets, the [[&mediaUrl]] placeHolder does not give relative path but an erroneous absolute path).
To Reproduce
This is in my frontmatter.json
"Image zoomable légendable": {
"description": "Cliquer sur l'image l'affichera en plus grand, et affichera la légende si elle est définie",
"body": "{{< image src=\"[[&mediaUrl]]\" caption=\"[[legende]]\" >}}",
"isMediaSnippet": true,
"fields": [
{
"name": "legende",
"title": "Légende",
"type": "string",
"default": ""
}
]
}
- Edited post path : [[workspace]]/content/blog/2019/André Mitton piste cyclable stationnable/index.md
- Choosen media path: [[workspace]]/content/blog/2019/André Mitton piste cyclable stationnable/img/photo3.jpg
When I am editing my post, click on the media button, and then choose the snippets on the desired image, vs-code frontmatter inputs in my post:
{{< image src="/content/blog/2019/André%20Mitton%20piste%20cyclable%20stationnable/img/photo3.jpg" caption="" >}}
I expected it to input
{{< image src="img/photo3.jpg" caption="" >}}
Note: The normal "insert image" button in media view (+"button on the image) works as expected, giving relative path.

This bug would not be very annoying if the absolute path vscode-frontmatter compute wasn't erroneous. This computation is based on filepath in my filesystem, and not based on the previewPath properties. Hugo translate filepath into an url-friendly version when generating site, and the absolute path calculation that does vs-code-frontmatter is not the same. Using a path based on previewPath (wich is supposed to work) would be less erroneous.
But what I expect and prefer, is to get a relative path as specified in the docs. Output is nicer, and I can pay attention for subdirectories of my post, so that they have url-friendly names that will not be transformed neither by Hugo, nor by vscode-frontmatter.
Device:
- OS: Linux
- Front Matter CMS Version : 10.7.0
- Browser : firefox
Additional context
My content type is in "pageBundle" mode.