diff --git a/CHANGELOG.md b/CHANGELOG.md index 087ff4e4..5cdafe9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### ⚡️ Optimizations - Dashboard layout grid optimizations +- Added the content-type name to the metadata section in the panel ### 🐞 Fixes diff --git a/src/commands/Folders.ts b/src/commands/Folders.ts index 0a6cfe0a..68000f43 100644 --- a/src/commands/Folders.ts +++ b/src/commands/Folders.ts @@ -361,7 +361,10 @@ export class Folders { */ public static get(): ContentFolder[] { const wsFolder = Folders.getWorkspaceFolder(); - const folders: ContentFolder[] = Settings.get(SETTING_CONTENT_PAGE_FOLDERS) as ContentFolder[]; + let folders: ContentFolder[] = Settings.get(SETTING_CONTENT_PAGE_FOLDERS) as ContentFolder[]; + + // Filter out folders without a path + folders = folders.filter((f) => f.path); const contentFolders = folders.map((folder) => { if (!folder.title) { diff --git a/src/hooks/useContentType.tsx b/src/hooks/useContentType.tsx index a0ab0fde..a457f378 100644 --- a/src/hooks/useContentType.tsx +++ b/src/hooks/useContentType.tsx @@ -19,7 +19,7 @@ export default function useContentType( // Get the content type by the folder name const pageFolders = settings.contentFolders; - let pageFolderMatches = pageFolders.filter((folder) => metadata.filePath.includes(folder.path)); + let pageFolderMatches = pageFolders.filter((folder) => metadata.filePath && folder.path && metadata.filePath.includes(folder.path)); // Sort by longest path pageFolderMatches = pageFolderMatches.sort((a, b) => b.path.length - a.path.length); diff --git a/src/panelWebView/components/Metadata.tsx b/src/panelWebView/components/Metadata.tsx index 4734da7e..0951cff7 100644 --- a/src/panelWebView/components/Metadata.tsx +++ b/src/panelWebView/components/Metadata.tsx @@ -89,7 +89,7 @@ const Metadata: React.FunctionComponent = ({ }; return ( - +