From b49458699376b18c3f5a018973669685e213ef62 Mon Sep 17 00:00:00 2001 From: LMBishop <13875753+LMBishop@users.noreply.github.com> Date: Sun, 21 Nov 2021 22:38:00 +0000 Subject: Handle purging deleted pages --- app/directory.mjs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'app/directory.mjs') diff --git a/app/directory.mjs b/app/directory.mjs index 1fddf23..89a6ee9 100644 --- a/app/directory.mjs +++ b/app/directory.mjs @@ -23,7 +23,12 @@ export function pageFor(path) { } export function buildPage(path) { - let data = readFileSync(`${PAGES_DIR}/${path}.wiki`, 'utf-8'); + let data; + try { + data = readFileSync(`${PAGES_DIR}/${path}.wiki`, 'utf-8'); + } catch { + return false; + } let result = parse(data); let title = result.metadata.displayTitle ?? 'Unnamed page'; let content = `