From ffa6638d3d689de8e1d363fdbd1c4a1911a8ab77 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Fri, 20 May 2022 16:25:08 +0200 Subject: [PATCH] #339 - Fix for content folders without a title --- CHANGELOG.md | 4 +++- src/commands/Folders.ts | 16 +++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db05c9d4..ddd3e0a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,11 +11,13 @@ - [#333](https://github.com/estruyf/vscode-front-matter/issues/333): Automatically mark Jekyll posts in `_drafts` folder as draft - [#335](https://github.com/estruyf/vscode-front-matter/issues/335): Merge media snippets with content snippets to allow you to define multiple media snippets and use these in your content - [#336](https://github.com/estruyf/vscode-front-matter/issues/336): Support added for inverting the draft field so that SSGs/authors can use a published field instead -- [#337](https://github.com/estruyf/vscode-front-matter/issues/337): Allow multiple front matter types to be used. +- [#337](https://github.com/estruyf/vscode-front-matter/issues/337): Allow multiple front matter types to be used +- [#338](https://github.com/estruyf/vscode-front-matter/issues/338): Ability to disable the templates functionality (default is disabled) ### 🐞 Fixes - [#334](https://github.com/estruyf/vscode-front-matter/issues/334): Fix for locked content folders retrieval +- [#339](https://github.com/estruyf/vscode-front-matter/issues/339): Fix for content folders without a title ## [7.2.0] - 2022-05-02 - [Release notes](https://beta.frontmatter.codes/updates/v7.2.0) diff --git a/src/commands/Folders.ts b/src/commands/Folders.ts index bb5b1cf0..7dfc4fdb 100644 --- a/src/commands/Folders.ts +++ b/src/commands/Folders.ts @@ -293,11 +293,17 @@ export class Folders { public static get(): ContentFolder[] { const wsFolder = Folders.getWorkspaceFolder(); const folders: ContentFolder[] = Settings.get(SETTING_CONTENT_PAGE_FOLDERS) as ContentFolder[]; - - return folders.map(folder => ({ - ...folder, - path: Folders.absWsFolder(folder, wsFolder) - })); + + return folders.map(folder => { + if (!folder.title) { + folder.title = basename(folder.path); + } + + return { + ...folder, + path: Folders.absWsFolder(folder, wsFolder) + } + }); } /**