Fix for tags rendering on content cards

This commit is contained in:
Elio Struyf
2022-07-13 13:52:06 +02:00
parent 463455121e
commit 149703a5df
2 changed files with 13 additions and 16 deletions
+3 -9
View File
@@ -1,18 +1,12 @@
# Change Log
## [8.1.0] - 2022-xx-xx
### ✨ New features
### 🎨 Enhancements
- Fix `PSD` media card icon image
### ⚡️ Optimizations
## [8.0.1] - 2022-07-13
### 🐞 Fixes
- Fix `PSD` media card icon image
- Fix missing clipboard icon for the media card action
- Fix in tags rendering on content cards
## [8.0.0] - 2022-07-11 - [Release notes](https://beta.frontmatter.codes/updates/v8.0.0)
@@ -30,20 +30,23 @@ export const Item: React.FunctionComponent<IItemProps> = ({ fmFilePath, date, ti
}
const tagField = settings.dashboardState.contents.tags;
let tagsValue = [];
if (tagField === "tags") {
return pageData.fmTags;
tagsValue = pageData.fmTags;
} else if (tagField === "categories") {
return pageData.fmCategories;
tagsValue = pageData.fmCategories;
} else {
tagsValue = pageData[tagField] || [];
}
const tagsValue = pageData[tagField] || [];
if (Array.isArray(tagsValue)) {
if (typeof tagsValue === "string") {
return [tagsValue];
} else if (Array.isArray(tagsValue)) {
return tagsValue;
}
return [tagsValue];
return [];
}, [settings, pageData]);
if (view === DashboardViewType.Grid) {
@@ -119,4 +122,4 @@ export const Item: React.FunctionComponent<IItemProps> = ({ fmFilePath, date, ti
}
return null;
};
};