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

Fixes #1041
This commit is contained in:
Elio Struyf
2026-06-22 12:02:50 +02:00
parent 0a4abf681f
commit de1bcbbe53
2 changed files with 3 additions and 11 deletions
+1
View File
@@ -13,6 +13,7 @@
### 🐞 Fixes
- Fix number fields not being saved to front matter when used inside block field groups
- [#1041](https://github.com/estruyf/vscode-front-matter/issues/1041): Fix in image page when using page bundles
## [10.10.1] - 2026-04-23
+2 -11
View File
@@ -7,7 +7,7 @@ import {
PlusIcon,
VideoCameraIcon,
} from '@heroicons/react/24/outline';
import { basename, parse } from 'path';
import { basename } from 'path';
import * as React from 'react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useRecoilState, useRecoilValue } from 'recoil';
@@ -57,17 +57,8 @@ export const Item: React.FunctionComponent<IItemProps> = ({
const [menuOpen, setMenuOpen] = React.useState(false);
const relPath = useMemo(() => {
if (viewData?.data?.pageBundle && viewData?.data?.filePath) {
const articlePath = viewData?.data?.filePath;
const articleDir = parse(parseWinPath(articlePath)).dir;
const mediaPath = parseWinPath(media.fsPath);
if (mediaPath.startsWith(articleDir)) {
return getRelPath(media.fsPath, undefined, articleDir);
}
}
return getRelPath(media.fsPath, settings?.staticFolder, settings?.wsFolder);
}, [media.fsPath, settings?.staticFolder, settings?.wsFolder, viewData?.data?.pageBundle, viewData?.data?.filePath]);
}, [media.fsPath, settings?.staticFolder, settings?.wsFolder]);
const hasViewData = useMemo(() => {
return viewData?.data?.filePath !== undefined;