/docs redirects to introduction

pull/8253/head
Puru Vijay 4 years ago
parent c93fa8f6ad
commit 61fe97f2f4

@ -359,7 +359,9 @@ function parse({ file, body, code, codespan }) {
throw new Error(`Unexpected <h${level}> in ${file}`);
}
return `<h${level} id="${slug}">${html}<a href="#${slug}" class="permalink"><span class="visually-hidden">permalink</span></a></h${level}>`;
return `<h${
level - 1
} id="${slug}">${html}<a href="#${slug}" class="permalink"><span class="visually-hidden">permalink</span></a></h${level}>`;
},
code: (source, language) => code(source, language, current),
codespan,

@ -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} */
export async function load({ fetch, setHeaders }) {
const sections = await (await fetch(`${PUBLIC_API_BASE}/docs/svelte/docs?content`)).json();
setHeaders({
'cache-control': 'public, max-age=60'
});
return { sections };
export async function load() {
throw redirect(307, `${base}/docs/introduction`);
}

@ -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>
/** @type {import('./$types').PageData}*/
export let data;
// $: console.log(data.page.content);
</script>
<svelte:head>
<title>{data.page.title} - Svelte</title>
</svelte:head>
{@html data.page.content}

Loading…
Cancel
Save