Skip to content

Commit 74883d8

Browse files
committed
feat: store draft metadata on blog posts
1 parent 8482ecc commit 74883d8

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

src/transform/docs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ export async function transform_blog(
9090
author: {
9191
name: doc.data.frontmatter.author,
9292
url: doc.data.frontmatter.authorURL,
93-
}
93+
},
94+
draft: doc.data.frontmatter.draft || false
9495
};
9596
})
9697
.sort((a, b) => (a.date.numeric < b.date.numeric ? 1 : -1));

src/transform/fixtures/blog.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ export const blog_out_full = [
3636
author: {
3737
name: 'Rich Harris',
3838
url: 'https://twitter.com/Rich_Harris'
39-
}
39+
},
40+
draft: false
4041
},
4142
{
4243
title: "The zen of Just Writing CSS",
@@ -52,7 +53,8 @@ export const blog_out_full = [
5253
author: {
5354
name: 'Rich Harris',
5455
url: 'https://twitter.com/Rich_Harris'
55-
}
56+
},
57+
draft: false
5658
},
5759
{
5860
title: "The easiest way to get started with Svelte",
@@ -68,7 +70,8 @@ export const blog_out_full = [
6870
author: {
6971
name: 'Rich Harris',
7072
url: 'https://twitter.com/Rich_Harris'
71-
}
73+
},
74+
draft: false
7275
},
7376
{
7477
title:
@@ -85,7 +88,8 @@ export const blog_out_full = [
8588
author: {
8689
name: 'Rich Harris',
8790
url: 'https://twitter.com/Rich_Harris'
88-
}
91+
},
92+
draft: false
8993
},
9094
];
9195

@@ -102,7 +106,8 @@ export const blog_out_list = [
102106
author: {
103107
name: 'Rich Harris',
104108
url: 'https://twitter.com/Rich_Harris'
105-
}
109+
},
110+
draft: false
106111
},
107112
{
108113
title: "The zen of Just Writing CSS",
@@ -116,7 +121,8 @@ export const blog_out_list = [
116121
author: {
117122
name: 'Rich Harris',
118123
url: 'https://twitter.com/Rich_Harris'
119-
}
124+
},
125+
draft: false
120126
},
121127
{
122128
title: "The easiest way to get started with Svelte",
@@ -130,7 +136,8 @@ export const blog_out_list = [
130136
author: {
131137
name: 'Rich Harris',
132138
url: 'https://twitter.com/Rich_Harris'
133-
}
139+
},
140+
draft: false
134141
},
135142
{
136143
title:
@@ -145,6 +152,7 @@ export const blog_out_list = [
145152
author: {
146153
name: 'Rich Harris',
147154
url: 'https://twitter.com/Rich_Harris'
148-
}
155+
},
156+
draft: false
149157
},
150158
];

src/transform/fixtures/everything.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,8 @@ export const everything = [
903903
author: {
904904
name: 'Rich Harris',
905905
url: 'https://twitter.com/Rich_Harris'
906-
}
906+
},
907+
draft: false
907908
},
908909
{
909910
title: "The zen of Just Writing CSS",
@@ -917,7 +918,8 @@ export const everything = [
917918
author: {
918919
name: 'Rich Harris',
919920
url: 'https://twitter.com/Rich_Harris'
920-
}
921+
},
922+
draft: false
921923
},
922924
{
923925
title: "The easiest way to get started with Svelte",
@@ -931,7 +933,8 @@ export const everything = [
931933
author: {
932934
name: 'Rich Harris',
933935
url: 'https://twitter.com/Rich_Harris'
934-
}
936+
},
937+
draft: false
935938
},
936939
{
937940
title:
@@ -946,7 +949,8 @@ export const everything = [
946949
author: {
947950
name: 'Rich Harris',
948951
url: 'https://twitter.com/Rich_Harris'
949-
}
952+
},
953+
draft: false
950954
},
951955
],
952956
full: [
@@ -964,7 +968,8 @@ export const everything = [
964968
author: {
965969
name: 'Rich Harris',
966970
url: 'https://twitter.com/Rich_Harris'
967-
}
971+
},
972+
draft: false
968973
},
969974
{
970975
title: "The zen of Just Writing CSS",
@@ -980,7 +985,8 @@ export const everything = [
980985
author: {
981986
name: 'Rich Harris',
982987
url: 'https://twitter.com/Rich_Harris'
983-
}
988+
},
989+
draft: false
984990
},
985991
{
986992
title: "The easiest way to get started with Svelte",
@@ -996,7 +1002,8 @@ export const everything = [
9961002
author: {
9971003
name: 'Rich Harris',
9981004
url: 'https://twitter.com/Rich_Harris'
999-
}
1005+
},
1006+
draft: false
10001007
},
10011008
{
10021009
title:
@@ -1013,7 +1020,8 @@ export const everything = [
10131020
author: {
10141021
name: 'Rich Harris',
10151022
url: 'https://twitter.com/Rich_Harris'
1016-
}
1023+
},
1024+
draft: false
10171025
},
10181026
],
10191027
},

0 commit comments

Comments
 (0)