File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11[
2- {
3- "slug" : " ashlight-setting-primer" ,
4- "title" : " Ashlight Setting Primer" ,
5- "excerpt" : " A brief description of your post that will appear in previews and summaries." ,
6- "tags" : [
7- " tag1" ,
8- " tag2" ,
9- " tag3"
10- ],
11- "content" : " " ,
12- "date" : " 2025-09-05" ,
13- "readingTime" : 5
14- },
152 {
163 "slug" : " retro-classic-game-asteroids-available" ,
174 "title" : " Retro-Classic Game Asteroids Available" ,
2411 "date" : " 2025-08-22" ,
2512 "readingTime" : 2
2613 },
27- {
28- "slug" : " the-surprising-history-of-solo-ttrpg-play" ,
29- "title" : " The Surprising History of Solo TTRPG Play" ,
30- "excerpt" : " A brief description of your post that will appear in previews and summaries." ,
31- "tags" : [
32- " tag1" ,
33- " tag2" ,
34- " tag3"
35- ],
36- "content" : " " ,
37- "date" : " 2025-08-18" ,
38- "readingTime" : 5
39- },
4014 {
4115 "slug" : " site-migration-complete" ,
4216 "title" : " Site Migration Complete" ,
Original file line number Diff line number Diff line change @@ -42,20 +42,17 @@ function buildSearchIndex(): SearchIndexItem[] {
4242 const files = fs . readdirSync ( POSTS_DIR )
4343 . filter ( file => / \. m d x ? $ / . test ( file ) )
4444 . filter ( file => {
45- // Filter out draft posts during production builds
46- if ( process . env . NODE_ENV === 'production' ) {
47- try {
48- const filePath = path . join ( POSTS_DIR , file ) ;
49- const fileContent = fs . readFileSync ( filePath , 'utf8' ) ;
50- const { data } = matter ( fileContent ) ;
51- const frontmatter = PostFrontmatterSchema . parse ( data ) ;
52- return frontmatter . draft !== true ;
53- } catch ( error ) {
54- console . warn ( `Warning: Error reading post ${ file } , excluding from search index:` , error ) ;
55- return false ;
56- }
45+ // Filter out draft posts from search index
46+ try {
47+ const filePath = path . join ( POSTS_DIR , file ) ;
48+ const fileContent = fs . readFileSync ( filePath , 'utf8' ) ;
49+ const { data } = matter ( fileContent ) ;
50+ const frontmatter = PostFrontmatterSchema . parse ( data ) ;
51+ return frontmatter . draft !== true ;
52+ } catch ( error ) {
53+ console . warn ( `Warning: Error reading post ${ file } , excluding from search index:` , error ) ;
54+ return false ;
5755 }
58- return true ;
5956 } )
6057 . sort ( ( a , b ) => b . localeCompare ( a ) ) ;
6158
You can’t perform that action at this time.
0 commit comments