File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
apps/svelte.dev/src/lib/server
packages/site-kit/src/lib/server/content Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -2,23 +2,24 @@ import { read } from '$app/server';
2
2
import type { Document , DocumentSummary } from '@sveltejs/site-kit' ;
3
3
import { create_index } from '@sveltejs/site-kit/server/content' ;
4
4
5
- const documents = import . meta. glob < string > ( '../../../content/**/*.md' , {
5
+ const documents = import . meta. glob < string > ( '**/*.md' , {
6
+ base : '../../../content' ,
6
7
eager : true ,
7
8
query : '?url' ,
8
9
import : 'default'
9
10
} ) ;
10
11
11
12
const assets = import . meta. glob < string > (
12
- [ '../../../content/ **/+assets/**' , '../../../content/ **/+assets/**/.env' ] ,
13
+ [ '**/+assets/**' , '**/+assets/**/.env' ] ,
13
14
{
15
+ base : '../../../content' ,
14
16
eager : true ,
15
17
query : '?url' ,
16
18
import : 'default'
17
19
}
18
20
) ;
19
21
20
- // https://github.com/vitejs/vite/issues/17453
21
- export const index = await create_index ( documents , assets , '../../../content' , read ) ;
22
+ export const index = await create_index ( documents , assets , read ) ;
22
23
23
24
const months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec' . split ( ' ' ) ;
24
25
Original file line number Diff line number Diff line change @@ -4,20 +4,18 @@ import type { Document } from '../../types';
4
4
export async function create_index (
5
5
documents : Record < string , string > ,
6
6
assets : Record < string , string > ,
7
- base : string ,
8
7
read : ( asset : string ) => Response
9
8
) : Promise < Record < string , Document > > {
10
9
const content : Record < string , Document > = { } ;
11
10
12
11
const roots : Document [ ] = [ ] ;
13
12
14
- for ( const key in documents ) {
15
- if ( key . includes ( '+assets' ) ) continue ;
13
+ for ( const file in documents ) {
14
+ if ( file . includes ( '+assets' ) ) continue ;
16
15
17
- const file = key . slice ( base . length + 1 ) ;
18
16
const slug = file . replace ( / ( ^ | \/ ) [ \d - ] + - / g, '$1' ) . replace ( / ( \/ i n d e x ) ? \. m d $ / , '' ) ;
19
17
20
- const text = await read ( documents [ key ] ) . text ( ) ;
18
+ const text = await read ( documents [ file ] ) . text ( ) ;
21
19
let { metadata, body } = extract_frontmatter ( text ) ;
22
20
23
21
if ( ! metadata . title ) {
You can’t perform that action at this time.
0 commit comments