diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 0f34299..6adb93c 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,9 +1,5 @@ - -

{PUBLIC_APP_ROOT}

diff --git a/src/routes/blog/[slug]/+page.svelte b/src/routes/blog/[slug]/+page.svelte index 13841ba..7145991 100644 --- a/src/routes/blog/[slug]/+page.svelte +++ b/src/routes/blog/[slug]/+page.svelte @@ -1,6 +1,6 @@ -

Slug: {$page.params.slug}

-

Type: {typeof $page.params.slug}

+ -

Content: {data.content}

- - + diff --git a/src/routes/blog/[slug]/+page.ts b/src/routes/blog/[slug]/+page.ts index db04a86..e8535dd 100644 --- a/src/routes/blog/[slug]/+page.ts +++ b/src/routes/blog/[slug]/+page.ts @@ -1,5 +1,6 @@ import { PUBLIC_APP_ROOT } from '$env/static/public'; +//TODO: Move these to their own files interface PageLoadRequest { slug: string; } @@ -8,12 +9,35 @@ interface PageLoadResult { content: string; } +const mockContent = ` +# This is a header + +This is a paragraph. + +* This is a list +* With two items + 1. And a sublist + 2. That is ordered + + * With another + * Sublist inside + +| And this is | A table | +|-------------|---------| +| With two | columns | +`; + /** @type {import('./$types').PageLoad} */ //TODO: Figure out what the type is for params //@ts-ignore export async function load({ params }): PageLoadResult { - const blogContent = await fetch(`${PUBLIC_APP_ROOT}/posts/test.md`); - return { content: await blogContent.text() }; + //TODO: Fix certificate issue so fetch works when running locally - returning mock content for now + if (PUBLIC_APP_ROOT === 'https://localhost:5173') { + return { content: mockContent }; + } else { + const blogContent = await fetch(`${PUBLIC_APP_ROOT}/posts/test.md`); + return { content: await blogContent.text() }; + } //throw error(404, 'Not found'); }