Skip to content

Commit

Permalink
Le0 x8 patch 1 (#59)
Browse files Browse the repository at this point in the history
* Create axrd.md

* Create +page.ts

* Create +page.svelte

* Create +page.ts

* Update +page.ts

* Create +page.svelte

* Update +page.svelte
  • Loading branch information
Le0X8 authored Jan 14, 2025
1 parent 54299a4 commit 8606b7f
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pages/custom-files/axrd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
<p>
Our CLI is documented <a href="/cli">here</a>.
</p>
<p>
Acridotheres has also some custom files in extracted archives. <a href="/custom-files">List of custom files</a>
</p>
21 changes: 21 additions & 0 deletions src/routes/custom-files/+page.svelte
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>
21 changes: 21 additions & 0 deletions src/routes/custom-files/+page.ts
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 };
}
16 changes: 16 additions & 0 deletions src/routes/custom-files/[page]/+page.svelte
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>
18 changes: 18 additions & 0 deletions src/routes/custom-files/[page]/+page.ts
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');
}
}

0 comments on commit 8606b7f

Please sign in to comment.