1+ // Compatibility for Node.js
2+ // Use the Bun script if you are using Bun
3+
14import { createConsola } from "consola" ;
25import fg from "fast-glob" ;
36import matter from "gray-matter" ;
@@ -16,12 +19,6 @@ const matchingFiles = fg.stream("**/+page.svx", { dot: true });
1619
1720// read all routes
1821for await ( const file of matchingFiles ) {
19- // ignore the error page
20- if ( file . includes ( "+error.svx" ) ) {
21- log . warn ( "Skipping error page" ) ;
22- continue ;
23- }
24-
2522 const rawContent = await readFile ( file ) ;
2623
2724 log . info ( "Transforming" , file ) ;
@@ -32,14 +29,21 @@ for await (const file of matchingFiles) {
3229 // add to posts
3330 const contentNoHtml = stripHtml ( frontmatter . content ) . result ;
3431 const strippedMarkdown = RemoveMarkdown ( contentNoHtml )
35- . replace ( / : : : .* / , "" )
36- . replace ( / : : : / , "" ) // remove admonitions
32+ . replaceAll ( / : : : .* / g, "" )
33+ . replaceAll ( / : : : / g, "" ) // remove admonitions
34+ . replaceAll ( / [ ^ \S \r \n ] { 2 , } / g, "" ) ; // remove extra spaces
3735
36+ const tags = frontmatter . data . tags || "" ;
3837
3938 posts . push ( {
4039 title : frontmatter . data . title || "MissingNo." ,
4140 content : strippedMarkdown ,
41+ description : frontmatter . data . description || null ,
4242 url : "/" + filePath ,
43+ tags : tags
44+ . split ( "," )
45+ . map ( el => el . trim ( ) )
46+ . filter ( String ) ,
4347 } ) ;
4448}
4549
0 commit comments