Skip to content

Commit c403c52

Browse files
feat: allow user to configure a static category for all pages in a databse
1 parent f0a81c1 commit c403c52

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/PropertiesParser.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ export class PropertiesParser {
3535
throw this.errorMissingRequiredProperty("of type 'title'", page);
3636
}
3737

38-
if (!category) {
38+
const theCategory = category || config.pages.frontmatter.category.static;
39+
40+
if (!theCategory) {
3941
throw this.errorMissingRequiredProperty(
40-
config.pages.frontmatter.category.property,
42+
config.pages.frontmatter.category.property || "static category",
4143
page
4244
);
4345
}
@@ -47,7 +49,7 @@ export class PropertiesParser {
4749
id: page.id,
4850
url: page.url,
4951
title: title, // notion API always calls it name
50-
category: category,
52+
category: theCategory,
5153
order: order,
5254
...config.pages.frontmatter.extra,
5355
},

src/SyncConfig.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ export interface DatabaseConfigRenderTable extends DatabaseConfigBase {
7373
*/
7474
emitToIndex: boolean;
7575
};
76-
77-
7876
}
7977

8078
export interface DatabaseConfigRenderPages extends DatabaseConfigBase {
@@ -90,8 +88,13 @@ export interface DatabaseConfigRenderPages extends DatabaseConfigBase {
9088
*
9189
* Example: "Cluster"
9290
*/
93-
property: string;
91+
property?: string;
92+
/**
93+
* A static category value to assign to every page
94+
*/
95+
static?: string;
9496
};
97+
9598
extra?: Record<string, any>;
9699
};
97100
};

0 commit comments

Comments
 (0)