File tree Expand file tree Collapse file tree 4 files changed +57
-6
lines changed
Expand file tree Collapse file tree 4 files changed +57
-6
lines changed Original file line number Diff line number Diff line change 1+ <h1 >404</h1 >
2+ <blockquote >
3+ <p >Not Found</p >
4+ <p >Take me <a href =" /eslint-plugin-svelte/" >home</a ></p >
5+ </blockquote >
6+
7+ <style >
8+ blockquote {
9+ text-align : center ;
10+ }
11+ </style >
Original file line number Diff line number Diff line change 1+ <script context =" module" >
2+ /** @type {import('@sveltejs/kit').ErrorLoad} */
3+ export function load ({ error, status }) {
4+ return {
5+ props: { error, status },
6+ }
7+ }
8+ </script >
9+
10+ <script >
11+ export let status, error
12+ </script >
13+
14+ <h1 >{status }</h1 >
15+ <blockquote >
16+ <p >{error .message }</p >
17+ <p >Take me <a href =" /eslint-plugin-svelte/" >home</a ></p >
18+ </blockquote >
Original file line number Diff line number Diff line change 44
55 /** @type {import('@sveltejs/kit').Load} */
66 export async function load ({ page }) {
7+ const markdown = ` ./${ markdownPath (page .path )} `
8+ if (docs[markdown]) {
9+ return {
10+ props: {
11+ moduleData: await docs[markdown](),
12+ },
13+ }
14+ }
15+
16+ // 404
717 return {
818 props: {
9- moduleData: await docs[` ./${ markdownPath (page .path )} ` ](),
19+ moduleData: {
20+ frontmatter: { title: " 404" , hiddenMenu: true },
21+ },
1022 },
1123 }
1224 }
Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ const dirname =
1313 const metaUrl = Function ( `return import.meta.url` ) ( )
1414 return path . dirname ( new URL ( metaUrl ) . pathname )
1515 } ) ( )
16+
17+ const baseStaticAdapter = staticAdapter ( {
18+ // default options are shown
19+ pages : "build" ,
20+ assets : "build" ,
21+ } )
1622/** @type {import('@sveltejs/kit').Config } */
1723const config = {
1824 compilerOptions : {
@@ -23,11 +29,15 @@ const config = {
2329 paths : {
2430 base : "/eslint-plugin-svelte" ,
2531 } ,
26- adapter : staticAdapter ( {
27- // default options are shown
28- pages : "build" ,
29- assets : "build" ,
30- } ) ,
32+ adapter : {
33+ name : baseStaticAdapter . name ,
34+
35+ async adapt ( arg ) {
36+ await baseStaticAdapter . adapt ( arg )
37+ arg . utils . copy ( "build/404/index.html" , "build/404.html" )
38+ arg . utils . rimraf ( "build/404" )
39+ } ,
40+ } ,
3141
3242 // hydrate the <div id="svelte"> element in src/app.html
3343 target : "#svelte" ,
You can’t perform that action at this time.
0 commit comments