From 4fafa3a172e05941b2d0edceb09d34ce4c124a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Gonz=C3=A1lez?= Date: Sat, 21 Jan 2023 11:47:23 -0600 Subject: [PATCH] Added changes to church --- src/pages/church/[id].astro | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/pages/church/[id].astro b/src/pages/church/[id].astro index cb7b0ca..67c0ad5 100644 --- a/src/pages/church/[id].astro +++ b/src/pages/church/[id].astro @@ -50,6 +50,7 @@ const n2m = new NotionToMarkdown({ notionClient: notion }); // @ts-ignore const mdblocks = await n2m.pageToMarkdown(id); const mdString = n2m.toMarkdownString(mdblocks); +const generalString = mdString.replace(/(\r\n|\n|\r)/gm, " ").replace(/(-|#)/gm, "").replaceAll(" ", " "); const mdArray = mdString.split("\n"); for (let i = 0; i < mdArray.length; i++) { @@ -63,19 +64,19 @@ const mdGood = mdArray.join("\n"); const htmlData = marked.parse(mdGood); -const title = mdString - .split("\n") - .find((line) => line.startsWith("# ")) - .replace("# ", ""); +const title = pageData.properties.title.title[0].plain_text.split(" | ").splice(0, pageData.properties.title.title[0].plain_text.split(" | ").length - 1).join(" - "); +const description = generalString.substring(0, 250); +console.log(description); const image = pageData.cover.external.url; --- +

{title}