File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 1
1
<script context =" module" >
2
- export async function load ({ page, fetch }) {
3
- const slug = page .path .split (' /' ).slice (- 1 )[0 ]; // last part of url path
4
- const url = ` /${ slug} .json` ;
5
- const res = await fetch (url);
2
+ export async function load ({ fetch, url }) {
3
+ const jsonUrl = url .pathname + ' .json' ;
4
+ const res = await fetch (jsonUrl);
6
5
7
6
if (res .ok ) {
8
7
return {
14
13
15
14
return {
16
15
status: res .status ,
17
- error: new Error (` Could not load ${ url } ` )
16
+ error: new Error (` Could not load ${ jsonUrl } ` )
18
17
};
19
18
}
20
19
</script >
Original file line number Diff line number Diff line change 11
11
posts .push (p);
12
12
}
13
13
14
- export function load ({ page }) {
15
- const { slug } = page . params ;
14
+ export function load ({ params }) {
15
+ const { slug } = params;
16
16
17
17
// Find the post with the slug
18
18
const filteredPost = posts .find ((p ) => {
Original file line number Diff line number Diff line change @@ -35,8 +35,6 @@ const config = {
35
35
extensions : extensions ,
36
36
37
37
kit : {
38
- // hydrate the <div id="svelte-root"> element in src/app.html
39
- target : '#svelte-root' ,
40
38
adapter : adapter ( )
41
39
}
42
40
} ;
You can’t perform that action at this time.
0 commit comments