Skip to content

Commit b4a0a39

Browse files
committed
fix: better colon handling in slug
1 parent cb19125 commit b4a0a39

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/NotionPage.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ export class NotionPage {
9999
if (explicitSlug) return explicitSlug;
100100
return encodeURIComponent(
101101
this.nameOrTitle.toLowerCase().replaceAll(" ", "-")
102-
);
102+
)
103+
.replaceAll("%3A", "-")
104+
.replaceAll("--", "-");
103105
}
104106
public get keywords(): string | undefined {
105107
return this.getPlainTextProperty("Keywords", "");

src/pull.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ async function outputPage(page: NotionPage) {
169169
let frontmatter = "---\n";
170170
frontmatter += `title: ${page.nameOrTitle.replaceAll(":", ":")}\n`; // markdown can't handle the ":" here
171171
frontmatter += `sidebar_position: ${currentSidebarPosition}\n`;
172-
frontmatter += `slug: ${page.slug.replaceAll(":", "-") ?? ""}\n`; // markdown can't handle the ":" or ":" here
172+
frontmatter += `slug: ${page.slug ?? ""}\n`;
173173
if (page.keywords) frontmatter += `keywords: [${page.keywords}]\n`;
174174

175175
frontmatter += "---\n";

0 commit comments

Comments
 (0)