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';
22import type { Document , DocumentSummary } from '@sveltejs/site-kit' ;
33import { create_index } from '@sveltejs/site-kit/server/content' ;
44
5- const documents = import . meta. glob < string > ( '../../../content/**/*.md' , {
5+ const documents = import . meta. glob < string > ( '**/*.md' , {
6+ base : '../../../content' ,
67 eager : true ,
78 query : '?url' ,
89 import : 'default'
910} ) ;
1011
1112const assets = import . meta. glob < string > (
12- [ '../../../content/ **/+assets/**' , '../../../content/ **/+assets/**/.env' ] ,
13+ [ '**/+assets/**' , '**/+assets/**/.env' ] ,
1314 {
15+ base : '../../../content' ,
1416 eager : true ,
1517 query : '?url' ,
1618 import : 'default'
1719 }
1820) ;
1921
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 ) ;
2223
2324const months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec' . split ( ' ' ) ;
2425
Original file line number Diff line number Diff line change @@ -4,20 +4,18 @@ import type { Document } from '../../types';
44export async function create_index (
55 documents : Record < string , string > ,
66 assets : Record < string , string > ,
7- base : string ,
87 read : ( asset : string ) => Response
98) : Promise < Record < string , Document > > {
109 const content : Record < string , Document > = { } ;
1110
1211 const roots : Document [ ] = [ ] ;
1312
14- for ( const key in documents ) {
15- if ( key . includes ( '+assets' ) ) continue ;
13+ for ( const file in documents ) {
14+ if ( file . includes ( '+assets' ) ) continue ;
1615
17- const file = key . slice ( base . length + 1 ) ;
1816 const slug = file . replace ( / ( ^ | \/ ) [ \d - ] + - / g, '$1' ) . replace ( / ( \/ i n d e x ) ? \. m d $ / , '' ) ;
1917
20- const text = await read ( documents [ key ] ) . text ( ) ;
18+ const text = await read ( documents [ file ] ) . text ( ) ;
2119 let { metadata, body } = extract_frontmatter ( text ) ;
2220
2321 if ( ! metadata . title ) {
You can’t perform that action at this time.
0 commit comments