Skip to content

Commit 2f330cc

Browse files
committed
Change slug generation
1 parent 570156f commit 2f330cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/transform.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ function getFrontMatter(page: NotionPage): string {
268268
let frontmatter = "---\n";
269269
frontmatter += `title: ${page.nameOrTitle.replaceAll(":", "-")}\n`; // I have not found a way to escape colons
270270
frontmatter += `sidebar_position: ${page.order}\n`;
271-
frontmatter += `slug: ${page.slug ?? ""}\n`;
271+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
272+
frontmatter += `slug: ${(((page as any).metadata.properties.Slug == undefined || (page as any).metadata.properties.Slug.rich_text.length == 0) ? (page as any).metadata.properties.Name.title[0].plain_text : (page as any).metadata.properties.Slug.rich_text[0].text.content).replace(" ", "-").replace(" ", "-")}\n`;
272273
if (page.keywords) frontmatter += `keywords: [${page.keywords}]\n`;
273274
frontmatter += `last_edited: ${(page.metadata as any).last_edited_time as string}\n`
274275
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions,@typescript-eslint/no-unsafe-return

0 commit comments

Comments
 (0)