mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
Improve slug retrieval
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
- [#645](https://github.com/estruyf/vscode-front-matter/issues/645): French localization added (thanks to [Clément Barbaza](https://github.com/cba85))
|
||||
- [#649](https://github.com/estruyf/vscode-front-matter/issues/649): Parse optional variables from snippets
|
||||
- [#652](https://github.com/estruyf/vscode-front-matter/issues/652): Show the start/stop server buttons depending on the local terminal session
|
||||
- [#654](https://github.com/estruyf/vscode-front-matter/issues/654): Added a new action to open the content in the browser
|
||||
|
||||
### 🐞 Fixes
|
||||
|
||||
|
||||
@@ -258,10 +258,16 @@ export class Preview {
|
||||
|
||||
if (!selectedFolder && article?.data && contentType && !contentType.previewPath) {
|
||||
// Try to find the folder by content type
|
||||
const crntFolders = folders.filter((folder) =>
|
||||
folder.contentTypes?.includes((contentType as ContentType).name)
|
||||
let crntFolders = folders.filter(
|
||||
(folder) =>
|
||||
folder.contentTypes?.includes((contentType as ContentType).name) && folder.previewPath
|
||||
);
|
||||
|
||||
// Use file path to find the folder
|
||||
if (crntFolders.length > 0) {
|
||||
crntFolders = crntFolders.filter((folder) => filePath?.startsWith(folder.path));
|
||||
}
|
||||
|
||||
if (crntFolders && crntFolders.length === 1) {
|
||||
selectedFolder = crntFolders[0];
|
||||
} else if (crntFolders && crntFolders.length > 1) {
|
||||
|
||||
Reference in New Issue
Block a user