mirror of https://github.com/sveltejs/svelte
parent
c93fa8f6ad
commit
61fe97f2f4
@ -1,12 +1,7 @@
|
|||||||
import { PUBLIC_API_BASE } from '$env/static/public';
|
import { base } from '$app/paths';
|
||||||
|
import { redirect } from '@sveltejs/kit';
|
||||||
|
|
||||||
/** @type {import('./$types').PageLoad} */
|
/** @type {import('./$types').PageLoad} */
|
||||||
export async function load({ fetch, setHeaders }) {
|
export async function load() {
|
||||||
const sections = await (await fetch(`${PUBLIC_API_BASE}/docs/svelte/docs?content`)).json();
|
throw redirect(307, `${base}/docs/introduction`);
|
||||||
|
|
||||||
setHeaders({
|
|
||||||
'cache-control': 'public, max-age=60'
|
|
||||||
});
|
|
||||||
|
|
||||||
return { sections };
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,43 +0,0 @@
|
|||||||
<script>
|
|
||||||
// import { Contents, Main, Section } from '@sveltejs/site-kit/docs';
|
|
||||||
|
|
||||||
/** @type {import('./$types').PageData} */
|
|
||||||
export let data;
|
|
||||||
|
|
||||||
let path;
|
|
||||||
|
|
||||||
$: contents = data.sections.map((section) => ({
|
|
||||||
path: `/docs#${section.slug}`,
|
|
||||||
title: section.title,
|
|
||||||
sections: section.sections.map((subsection) => ({
|
|
||||||
path: `/docs#${subsection.slug}`,
|
|
||||||
title: subsection.title,
|
|
||||||
sections: subsection.sections.map((subsection) => ({
|
|
||||||
path: `/docs#${subsection.slug}`,
|
|
||||||
title: subsection.title,
|
|
||||||
})),
|
|
||||||
})),
|
|
||||||
}));
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<svelte:head>
|
|
||||||
<title>Docs • Svelte</title>
|
|
||||||
|
|
||||||
<meta name="twitter:title" content="Svelte docs" />
|
|
||||||
<meta name="twitter:description" content="Complete documentation for Svelte" />
|
|
||||||
<meta name="Description" content="Complete documentation for Svelte" />
|
|
||||||
</svelte:head>
|
|
||||||
|
|
||||||
<!-- <Main bind:path>
|
|
||||||
<h1>Documentation</h1>
|
|
||||||
|
|
||||||
{#each data.sections as section}
|
|
||||||
<Section
|
|
||||||
{section}
|
|
||||||
edit="https://github.com/sveltejs/svelte/edit/master/site/content/docs/{section.file}"
|
|
||||||
base="/docs"
|
|
||||||
/>
|
|
||||||
{/each}
|
|
||||||
</Main>
|
|
||||||
|
|
||||||
<Contents {contents} {path} /> -->
|
|
||||||
@ -1,8 +1,10 @@
|
|||||||
<script>
|
<script>
|
||||||
/** @type {import('./$types').PageData}*/
|
/** @type {import('./$types').PageData}*/
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
// $: console.log(data.page.content);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>{data.page.title} - Svelte</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
{@html data.page.content}
|
{@html data.page.content}
|
||||||
|
|||||||
Loading…
Reference in new issue