Issue: Can't previe index.md of hugo reaf bundle with "previewPath": "/{{pathToken.relPath}}" #603

This commit is contained in:
Elio Struyf
2023-07-12 09:22:57 +02:00
parent dee11aedce
commit e32813847f
2 changed files with 7 additions and 1 deletions
+1
View File
@@ -40,6 +40,7 @@
- [#590](https://github.com/estruyf/vscode-front-matter/issues/590): Fix for image fields inside a sub-block
- [#595](https://github.com/estruyf/vscode-front-matter/issues/595): Fix for media metadata now showing up
- [#596](https://github.com/estruyf/vscode-front-matter/issues/596): Fix for number field in block data
- [#603](https://github.com/estruyf/vscode-front-matter/issues/603): Fix problem with page bundles and path placeholders
## [8.4.0] - 2023-04-03 - [Release notes](https://beta.frontmatter.codes/updates/v8.4.0)
+6 -1
View File
@@ -11,7 +11,7 @@ import {
SETTING_DATE_FORMAT
} from './../constants';
import { ArticleHelper } from './../helpers/ArticleHelper';
import { join } from 'path';
import { join, parse } from 'path';
import { commands, env, Uri, ViewColumn, window, WebviewPanel } from 'vscode';
import { Extension, parseWinPath, processKnownPlaceholders, Settings } from '../helpers';
import { ContentFolder, ContentType, PreviewSettings } from '../models';
@@ -290,6 +290,11 @@ export class Preview {
const folderPath = wsFolder ? parseWinPath(wsFolder.fsPath) : '';
const relativePath = filePath.replace(folderPath, '');
pathname = processPathPlaceholders(pathname, relativePath, filePath, selectedFolder);
const file = parse(filePath);
if (file.name.toLowerCase() === 'index' && pathname.endsWith(slug)) {
slug = '';
}
}
// Support front matter placeholders - {{fm.<field>}}