File tree Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Expand file tree Collapse file tree 2 files changed +26
-10
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,36 @@ exports.sourceNodes = async (
1515 reporter ,
1616 )
1717
18+ /*
19+ if (page.properties[key].type == "rich_text") {
20+ page.properties[key].rich_text = blockToString(page.properties[key].rich_text)
21+ }
22+ */
23+
1824 pages . forEach ( ( page ) => {
1925 const title = getNotionPageTitle ( page )
2026 const properties = getNotionPageProperties ( page )
2127 const frontmatter = Object . keys ( properties ) . reduce (
22- ( acc , key ) => ( {
23- ...acc ,
24- [ key ] : properties [ key ] . value ,
25- } ) ,
28+ ( acc , key ) => {
29+ if ( properties [ key ] . type == "date" ) {
30+ return {
31+ ...acc ,
32+ [ key ] : properties [ key ] . value . start ,
33+ }
34+ }
35+
36+ if ( properties [ key ] . type == "rich_text" ) {
37+ return {
38+ ...acc ,
39+ [ key ] : blockToString ( properties [ key ] . value ) ,
40+ }
41+ }
42+
43+ return {
44+ ...acc ,
45+ [ key ] : properties [ key ] . value ,
46+ }
47+ } ,
2648 { title } ,
2749 )
2850 const markdown = "---\n"
Original file line number Diff line number Diff line change 1- const { blockToString } = require ( "../block-to-string" )
2-
31exports . getNotionPageProperties = ( page ) =>
42 Object . keys ( page . properties ) . reduce ( ( acc , key ) => {
53 if ( page . properties [ key ] . type == "title" ) {
64 return acc
75 }
86
9- if ( page . properties [ key ] . type == "rich_text" ) {
10- page . properties [ key ] . rich_text = blockToString ( page . properties [ key ] . rich_text )
11- }
12-
137 return {
148 ...acc ,
159 [ key ] : {
You can’t perform that action at this time.
0 commit comments