File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { dump } from 'js-yaml';
17
17
import got from 'got' ;
18
18
19
19
import { markdown } from '#markdown' ;
20
+ import { getPropertyContent } from '#property' ;
20
21
21
22
import type { Got , OptionsOfJSONResponseBody , Response } from 'got' ;
22
23
import type {
@@ -28,7 +29,6 @@ import type {
28
29
FullPage ,
29
30
List ,
30
31
Page ,
31
- TitleValue ,
32
32
} from './types' ;
33
33
34
34
interface Pagination extends Record < string , number | string | undefined > {
@@ -178,11 +178,10 @@ export class Notion {
178
178
private async normalisePage ( page : Page ) : Promise < FullPage > {
179
179
const blocks = await this . getBlocks ( page . id ) ;
180
180
// Name for a page in a database, title for an ordinary page
181
- /* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition */
182
- const titleBlock = ( page . properties . Name ??
183
- page . properties . title ) as TitleValue ;
184
-
185
- const title = titleBlock . title . map ( ( text ) => text . plain_text ) . join ( '' ) ;
181
+ const title = getPropertyContent (
182
+ /* eslint-disable-next-line @typescript-eslint/no-unnecessary-condition */
183
+ page . properties . Name ?? page . properties . title ,
184
+ ) as string ;
186
185
const frontmatter = [
187
186
'---' ,
188
187
dump (
You can’t perform that action at this time.
0 commit comments