diff --git a/blog/types.ts b/blog/types.ts index 0f04aa57a..540d102b3 100644 --- a/blog/types.ts +++ b/blog/types.ts @@ -18,6 +18,7 @@ export interface Category { } export interface BlogPost { + name: string; title: string; excerpt: string; image?: ImageWidget; diff --git a/blog/utils/records.ts b/blog/utils/records.ts index 02744803c..6ec54bbdd 100644 --- a/blog/utils/records.ts +++ b/blog/utils/records.ts @@ -14,5 +14,11 @@ export async function getRecordsByPath( return key.startsWith(path) ? value : []; }); - return (current as Record[]).map((item) => item[accessor]); + return (current as Record[]).map((item) => { + const name = (item.name as string).split(path)[1]?.replace("/", ""); + return { + ...item[accessor], + name, + }; + }); }