Issue: Hugo page bundle images inserted from local img/ folder use incorrect leading slash path #774

Closed
opened 2026-10-05 03:04:48 +02:00 by adam · 1 comment
Owner

When inserting an image from the page bundle's local img/ subfolder using Front Matter CMS's media panel, the inserted path is prefixed with a leading / (e.g., /img/image_5682.webp). This produces an absolute path that resolves to the site root rather than a relative path within the page bundle. In Hugo page bundles, images collocated with the content file should be referenced with a relative path (e.g., img/image_5682.webp) - without the leading slash.

To Reproduce

  • Open a Hugo project that uses page bundles and an img/ subfolder with images)
  • Open a post
  • Open the Front Matter CMS media panel and navigate to the post's local img/ folder
  • Insert an image into the markdown content
  • Observe that the inserted path begins with /img/... instead of img/...

Expected behavior

When inserting an image from a page bundle's local asset folder, the path should be relative to the content file - e.g., img/image_5682.webp - not absolute from the site root (/img/image_5682.webp). Hugo resolves page bundle resources relative to the bundle folder, so a leading / causes the image to fail to render or point to a nonexistent location at the site root.

Device

OS: Windows 11

Front Matter CMS Version: 10.10.1

Browser: Visual Studio Code (extension panel)

Additional context

The project uses Hugo page bundles where each post is a folder (content/posts/post-slug/) containing [index.md] and an img/ subfolder for collocated images.

The Hugo framework is configured with "frontMatter.framework.id": "hugo".

Image references in the existing content consistently use relative paths without a leading slash (e.g., img/image_5682.webp), and these render correctly.

The issue appears to affect only images inserted from the page bundle's local folder - not images from the global folder where an absolute path would be expected.

Thanks
--Jesper

When inserting an image from the page bundle's local img/ subfolder using Front Matter CMS's media panel, the inserted path is prefixed with a leading / (e.g., /img/image_5682.webp). This produces an absolute path that resolves to the site root rather than a relative path within the page bundle. In Hugo page bundles, images collocated with the content file should be referenced with a relative path (e.g., img/image_5682.webp) - without the leading slash. ## To Reproduce - Open a Hugo project that uses page bundles and an img/ subfolder with images) - Open a post - Open the Front Matter CMS media panel and navigate to the post's local img/ folder - Insert an image into the markdown content - Observe that the inserted path begins with /img/... instead of img/... ## Expected behavior When inserting an image from a page bundle's local asset folder, the path should be relative to the content file - e.g., img/image_5682.webp - not absolute from the site root (/img/image_5682.webp). Hugo resolves page bundle resources relative to the bundle folder, so a leading / causes the image to fail to render or point to a nonexistent location at the site root. ## Device OS: Windows 11 Front Matter CMS Version: 10.10.1 Browser: Visual Studio Code (extension panel) ## Additional context The project uses Hugo page bundles where each post is a folder (content/posts/post-slug/) containing [index.md] and an img/ subfolder for collocated images. The Hugo framework is configured with "frontMatter.framework.id": "hugo". Image references in the existing content consistently use relative paths without a leading slash (e.g., img/image_5682.webp), and these render correctly. The issue appears to affect only images inserted from the page bundle's local folder - not images from the global folder where an absolute path would be expected. Thanks --Jesper <!-- github-sync-id:4700610105 -->
adam closed this issue 2026-10-05 03:04:48 +02:00
Author
Owner

Fix is coming up in the beta version 10.11.279448739. Let me know if it's fixed on your end, too.

Fix is coming up in the beta version `10.11.279448739`. Let me know if it's fixed on your end, too. <!-- github-comment-id:4767150069 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#774