Skip to content

Commit 09ed4c5

Browse files
feat(blog): add sticky field to blog entry metadata
1 parent a5358f3 commit 09ed4c5

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

blog/blog.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface BlogEntryMeta {
1313
mail: string;
1414
published: string;
1515
language: string;
16+
sticky?: boolean;
1617
header?: ImageDimensions & { url: string };
1718
// Optional fields (only included if present)
1819
author2?: string;

blog/blog.utils.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ describe('makeLightBlogList', () => {
9191
expect(meta.published).toBe(publishedDate);
9292
expect(meta.language).toBe('de');
9393
expect(meta.header).toEqual({ url: 'img.jpg', width: 100, height: 50 });
94+
expect(meta.sticky).toBe(true);
9495

9596
// These should NOT be included in light version
9697
expect(Object.hasOwn(meta, 'hidden')).toBe(false);
@@ -100,7 +101,6 @@ describe('makeLightBlogList', () => {
100101
expect(Object.hasOwn(meta, 'bioHeading')).toBe(false);
101102
expect(Object.hasOwn(meta, 'bio2')).toBe(false);
102103
expect(Object.hasOwn(meta, 'bio2Heading')).toBe(false);
103-
expect(Object.hasOwn(meta, 'sticky')).toBe(false);
104104
});
105105

106106
it('should include author2 and mail2 if present', () => {

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.sticky) { result.meta.sticky = entry.meta.sticky; }
2122
if (entry.meta.author2) { result.meta.author2 = entry.meta.author2; }
2223
if (entry.meta.mail2) { result.meta.mail2 = entry.meta.mail2; }
2324
if (entry.meta.isUpdatePost) { result.meta.isUpdatePost = entry.meta.isUpdatePost; }

0 commit comments

Comments
 (0)