-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create axrd.md * Create +page.ts * Create +page.svelte * Create +page.ts * Update +page.ts * Create +page.svelte * Update +page.svelte
- Loading branch information
Showing
6 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script lang="ts"> | ||
export let data: { pages: { | ||
path: string; | ||
title: string; | ||
filePath: string; | ||
}[] }; | ||
</script> | ||
|
||
<svelte:head> | ||
<title>List of custom file documentation pages | Acridotheres for Developers</title> | ||
</svelte:head> | ||
|
||
<h1>List of custom file documentation pages</h1> | ||
|
||
<ul> | ||
{#each data.pages as page} | ||
<li> | ||
<a href="{`/custom-files/${page.path}`}">{page.title} ({page.filePath})</a> | ||
</li> | ||
{/each} | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export async function load() { | ||
const pages = import.meta.glob('/src/pages/custom-files/*.md', { eager: true }) as Record< | ||
string, | ||
{ | ||
metadata: { | ||
title: string; | ||
path: string; | ||
}; | ||
} | ||
>; | ||
const keys = Object.keys(pages); | ||
const pageList = keys.map((key) => { | ||
const page = { | ||
title: pages[key].metadata.title, | ||
filePath: pages[key].metadata.path, | ||
path: key.split('/').at(-1)?.replace('.md', '') as string, | ||
}; | ||
return page; | ||
}); | ||
return { pages: pageList }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script lang="ts"> | ||
export let data; | ||
</script> | ||
|
||
<a href="https://github.com/acridotheres/developers/blob/main/src/pages/custom-files/{data.path}.md?plain=1" class="block w-full text-right mt-6" target="_blank">view this page on GitHub</a> | ||
|
||
<h1 class="mt-0">{data.metadata.title} | Acridotheres for Developers</h1> | ||
|
||
<p>Path: {data.metadata.path}</p> | ||
|
||
|
||
<svelte:component this={data.content} /> | ||
|
||
<div class="flex w-full gap-2 border-t border-t-black pt-1"> | ||
<a href="/custom-files" class="grow no-underline block text-center">back to all pages</a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { error } from '@sveltejs/kit'; | ||
|
||
export async function load({ params }) { | ||
try { | ||
const content = await import(`$p/custom-files/${params.page}.md`); | ||
|
||
return { | ||
content: content.default, | ||
metadata: content.metadata as { | ||
title: string; | ||
path: string; | ||
}, | ||
path: params.page | ||
}; | ||
} catch { | ||
error(404, 'Not Found'); | ||
} | ||
} |