diff --git a/web/pages/constitution.tsx b/web/pages/constitution.tsx index 094f437c..5aea3e02 100644 --- a/web/pages/constitution.tsx +++ b/web/pages/constitution.tsx @@ -4,7 +4,7 @@ import fs from 'fs'; import path from 'path'; import MarkdownPage from "web/components/markdown"; -const FILENAME = 'constitution'; +const FILENAME = __filename.split('/').pop()?.split('.').shift(); export async function getStaticProps() { const filePath = path.join(process.cwd(), 'public', 'md', FILENAME + '.md'); @@ -15,5 +15,6 @@ export async function getStaticProps() { type Props = { content: string }; export default function Faq({content}: Props) { + if (!FILENAME) throw new Error('Could not determine filename'); return } diff --git a/web/pages/faq.tsx b/web/pages/faq.tsx index e16482eb..5aea3e02 100644 --- a/web/pages/faq.tsx +++ b/web/pages/faq.tsx @@ -4,7 +4,7 @@ import fs from 'fs'; import path from 'path'; import MarkdownPage from "web/components/markdown"; -const FILENAME = 'faq'; +const FILENAME = __filename.split('/').pop()?.split('.').shift(); export async function getStaticProps() { const filePath = path.join(process.cwd(), 'public', 'md', FILENAME + '.md'); @@ -15,5 +15,6 @@ export async function getStaticProps() { type Props = { content: string }; export default function Faq({content}: Props) { + if (!FILENAME) throw new Error('Could not determine filename'); return } diff --git a/web/pages/financials.tsx b/web/pages/financials.tsx index 0cd4f412..5aea3e02 100644 --- a/web/pages/financials.tsx +++ b/web/pages/financials.tsx @@ -4,7 +4,7 @@ import fs from 'fs'; import path from 'path'; import MarkdownPage from "web/components/markdown"; -const FILENAME = 'financials'; +const FILENAME = __filename.split('/').pop()?.split('.').shift(); export async function getStaticProps() { const filePath = path.join(process.cwd(), 'public', 'md', FILENAME + '.md'); @@ -15,5 +15,6 @@ export async function getStaticProps() { type Props = { content: string }; export default function Faq({content}: Props) { + if (!FILENAME) throw new Error('Could not determine filename'); return } diff --git a/web/pages/members.tsx b/web/pages/members.tsx index a21ef753..5aea3e02 100644 --- a/web/pages/members.tsx +++ b/web/pages/members.tsx @@ -4,7 +4,7 @@ import fs from 'fs'; import path from 'path'; import MarkdownPage from "web/components/markdown"; -const FILENAME = 'members'; +const FILENAME = __filename.split('/').pop()?.split('.').shift(); export async function getStaticProps() { const filePath = path.join(process.cwd(), 'public', 'md', FILENAME + '.md'); @@ -15,5 +15,6 @@ export async function getStaticProps() { type Props = { content: string }; export default function Faq({content}: Props) { + if (!FILENAME) throw new Error('Could not determine filename'); return }