site: init
This commit is contained in:
committed by
Johannes Kirschbauer
parent
6b5dca5842
commit
d92623f07e
11
site/src/routes/+layout.svelte
Normal file
11
site/src/routes/+layout.svelte
Normal file
@@ -0,0 +1,11 @@
|
||||
<script lang="ts">
|
||||
import favicon from '$lib/assets/favicon.svg';
|
||||
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="icon" href={favicon} />
|
||||
</svelte:head>
|
||||
|
||||
{@render children?.()}
|
||||
4
site/src/routes/+page.svelte
Normal file
4
site/src/routes/+page.svelte
Normal file
@@ -0,0 +1,4 @@
|
||||
<h1>Welcome to Clan</h1>
|
||||
<p>
|
||||
<a href="/docs">Show Docs</a>
|
||||
</p>
|
||||
12
site/src/routes/docs/+layout.svelte
Normal file
12
site/src/routes/docs/+layout.svelte
Normal file
@@ -0,0 +1,12 @@
|
||||
<script>
|
||||
let { data, children } = $props();
|
||||
let { paths } = data;
|
||||
</script>
|
||||
|
||||
<nav>
|
||||
{#each paths as path}
|
||||
<li><a href={`/docs/${path}`}>{path}</a></li>
|
||||
{/each}
|
||||
<li><a href="/">Home</a></li>
|
||||
</nav>
|
||||
{@render children()}
|
||||
8
site/src/routes/docs/+layout.ts
Normal file
8
site/src/routes/docs/+layout.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
const articles = import.meta.glob("./**/*.md");
|
||||
|
||||
export function load() {
|
||||
const paths = Object.keys(articles).map((key) =>
|
||||
key.slice("./".length, -".md".length),
|
||||
);
|
||||
return { paths };
|
||||
}
|
||||
3
site/src/routes/docs/+page.svelte
Normal file
3
site/src/routes/docs/+page.svelte
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1>What is Clan</h1>
|
||||
|
||||
Content
|
||||
6
site/src/routes/docs/[...path]/+page.svelte
Normal file
6
site/src/routes/docs/[...path]/+page.svelte
Normal file
@@ -0,0 +1,6 @@
|
||||
<script lang="ts">
|
||||
let { data } = $props();
|
||||
let { Content, metadata } = data;
|
||||
</script>
|
||||
|
||||
<Content />
|
||||
24
site/src/routes/docs/[...path]/+page.ts
Normal file
24
site/src/routes/docs/[...path]/+page.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { error } from "@sveltejs/kit";
|
||||
import type { Component } from "svelte";
|
||||
|
||||
const articles = import.meta.glob<{
|
||||
metadata: {
|
||||
layout?: string;
|
||||
};
|
||||
default: Component;
|
||||
}>("../**/*.md");
|
||||
|
||||
export async function load({ params }) {
|
||||
const article = articles[`../${params.path}.md`];
|
||||
if (!article) {
|
||||
error(404, "");
|
||||
}
|
||||
|
||||
const { metadata, default: Content } = await article();
|
||||
return {
|
||||
Content,
|
||||
metadata: {
|
||||
...metadata,
|
||||
},
|
||||
};
|
||||
}
|
||||
1
site/src/routes/docs/deep/level/content/overview.md
Normal file
1
site/src/routes/docs/deep/level/content/overview.md
Normal file
@@ -0,0 +1 @@
|
||||
# Deep Overview
|
||||
1
site/src/routes/docs/getting-started/overview.md
Normal file
1
site/src/routes/docs/getting-started/overview.md
Normal file
@@ -0,0 +1 @@
|
||||
# Getting Started Overview
|
||||
1
site/src/routes/docs/reference/overview.md
Normal file
1
site/src/routes/docs/reference/overview.md
Normal file
@@ -0,0 +1 @@
|
||||
# Reference Overview
|
||||
Reference in New Issue
Block a user