File tree 4 files changed +57
-6
lines changed
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 4
4
5
5
/** @type {import('@sveltejs/kit').Load} */
6
6
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
7
17
return {
8
18
props: {
9
- moduleData: await docs[` ./${ markdownPath (page .path )} ` ](),
19
+ moduleData: {
20
+ frontmatter: { title: " 404" , hiddenMenu: true },
21
+ },
10
22
},
11
23
}
12
24
}
Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ const dirname =
13
13
const metaUrl = Function ( `return import.meta.url` ) ( )
14
14
return path . dirname ( new URL ( metaUrl ) . pathname )
15
15
} ) ( )
16
+
17
+ const baseStaticAdapter = staticAdapter ( {
18
+ // default options are shown
19
+ pages : "build" ,
20
+ assets : "build" ,
21
+ } )
16
22
/** @type {import('@sveltejs/kit').Config } */
17
23
const config = {
18
24
compilerOptions : {
@@ -23,11 +29,15 @@ const config = {
23
29
paths : {
24
30
base : "/eslint-plugin-svelte" ,
25
31
} ,
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
+ } ,
31
41
32
42
// hydrate the <div id="svelte"> element in src/app.html
33
43
target : "#svelte" ,
You can’t perform that action at this time.
0 commit comments