File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,27 @@ exports.sourceNodes = async (
1212 pages : await getPages ( pluginOptions , reporter ) ,
1313 }
1414
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+
1629 createNode ( {
1730 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 ,
1836 raw : page ,
1937 parent : null ,
2038 children : [ ] ,
@@ -23,6 +41,6 @@ exports.sourceNodes = async (
2341 content : JSON . stringify ( page ) ,
2442 contentDigest : createContentDigest ( page ) ,
2543 } ,
26- } ) ,
27- )
44+ } )
45+ } )
2846}
You can’t perform that action at this time.
0 commit comments