File tree 1 file changed +21
-3
lines changed
1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,27 @@ exports.sourceNodes = async (
12
12
pages : await getPages ( pluginOptions , reporter ) ,
13
13
}
14
14
15
- data . pages . forEach ( ( page ) =>
15
+ data . pages . forEach ( ( page ) => {
16
+ const properties = Object . keys ( page . properties ) . reduce (
17
+ ( acc , key ) =>
18
+ acc . concat ( [
19
+ {
20
+ key,
21
+ ...page . properties [ key ] ,
22
+ } ,
23
+ ] ) ,
24
+ [ ] ,
25
+ )
26
+
27
+ const title = properties . find ( ( property ) => property . type == "title" ) . title [ 0 ] . plain_text
28
+
16
29
createNode ( {
17
30
id : createNodeId ( `${ NODE_TYPE } -${ page . id } ` ) ,
31
+ title,
32
+ properties,
33
+ archived : page . archived ,
34
+ createdAt : page . created_time ,
35
+ updatedAt : page . last_edited_time ,
18
36
raw : page ,
19
37
parent : null ,
20
38
children : [ ] ,
@@ -23,6 +41,6 @@ exports.sourceNodes = async (
23
41
content : JSON . stringify ( page ) ,
24
42
contentDigest : createContentDigest ( page ) ,
25
43
} ,
26
- } ) ,
27
- )
44
+ } )
45
+ } )
28
46
}
You can’t perform that action at this time.
0 commit comments