Skip to content

Commit 190223c

Browse files
committed
list.json: keywords ins Light-Meta aufnehmen
Additiv und rückwärtskompatibel: Konsumenten der list.json können damit nach Keywords filtern, ohne jedes entry.json zu laden (z.B. der Zwei-Quellen-Blog der agentic.schule).
1 parent 0bb1055 commit 190223c

4 files changed

Lines changed: 791 additions & 17 deletions

File tree

blog/blog.types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export interface BlogEntryMeta {
1313
mail: string;
1414
published: string;
1515
language: string;
16+
/** Frontmatter-Keywords — im Light-Meta enthalten, damit Konsumenten
17+
* (z.B. Zwei-Quellen-Merge der agentic.schule) ohne entry.json filtern können. */
18+
keywords?: string[];
1619
sticky?: boolean;
1720
header?: ImageDimensions & { url: string };
1821
// Optional fields (only included if present)

blog/blog.utils.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@ describe('makeLightBlogList', () => {
9292
expect(meta.language).toBe('de');
9393
expect(meta.header).toEqual({ url: 'img.jpg', width: 100, height: 50 });
9494
expect(meta.sticky).toBe(true);
95+
// keywords ARE included in the light version — consumers (e.g. the
96+
// agentic.schule two-source blog) filter the list without entry.json
97+
expect(meta.keywords).toEqual(['angular', 'test']);
9598

9699
// These should NOT be included in light version
97100
expect(Object.hasOwn(meta, 'hidden')).toBe(false);
98101
expect(Object.hasOwn(meta, 'darkenHeader')).toBe(false);
99-
expect(Object.hasOwn(meta, 'keywords')).toBe(false);
100102
expect(Object.hasOwn(meta, 'bio')).toBe(false);
101103
expect(Object.hasOwn(meta, 'bioHeading')).toBe(false);
102104
expect(Object.hasOwn(meta, 'bio2')).toBe(false);

blog/blog.utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export function makeLightBlogList(fullList: BlogEntryFull[]): BlogEntry[] {
1818
},
1919
};
2020

21+
if (entry.meta.keywords?.length) { result.meta.keywords = entry.meta.keywords; }
2122
if (entry.meta.sticky) { result.meta.sticky = entry.meta.sticky; }
2223
if (entry.meta.author2) { result.meta.author2 = entry.meta.author2; }
2324
if (entry.meta.mail2) { result.meta.mail2 = entry.meta.mail2; }

0 commit comments

Comments
 (0)