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 (
15
15
reporter ,
16
16
)
17
17
18
+ /*
19
+ if (page.properties[key].type == "rich_text") {
20
+ page.properties[key].rich_text = blockToString(page.properties[key].rich_text)
21
+ }
22
+ */
23
+
18
24
pages . forEach ( ( page ) => {
19
25
const title = getNotionPageTitle ( page )
20
26
const properties = getNotionPageProperties ( page )
21
27
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
+ } ,
26
48
{ title } ,
27
49
)
28
50
const markdown = "---\n"
Original file line number Diff line number Diff line change 1
- const { blockToString } = require ( "../block-to-string" )
2
-
3
1
exports . getNotionPageProperties = ( page ) =>
4
2
Object . keys ( page . properties ) . reduce ( ( acc , key ) => {
5
3
if ( page . properties [ key ] . type == "title" ) {
6
4
return acc
7
5
}
8
6
9
- if ( page . properties [ key ] . type == "rich_text" ) {
10
- page . properties [ key ] . rich_text = blockToString ( page . properties [ key ] . rich_text )
11
- }
12
-
13
7
return {
14
8
...acc ,
15
9
[ key ] : {
You can’t perform that action at this time.
0 commit comments