@@ -58,7 +58,7 @@ module.exports = function (
5858 const items : ContentItem [ ] = [ ] ;
5959
6060 try {
61- // Access docs through the preset's routeBasePath
61+ // Load docs
6262 const docsRouteBasePath = 'docs' ;
6363 const docsDir = path . join ( context . siteDir , docsRouteBasePath ) ;
6464
@@ -72,14 +72,11 @@ module.exports = function (
7272 const fileNameMatch = file . match ( / ( [ ^ / ] + ) \. m d x ? $ / ) ;
7373 const fileName = fileNameMatch ? fileNameMatch [ 1 ] : '' ;
7474
75- // Basic frontmatter parsing
7675 const matter = require ( 'gray-matter' ) ;
7776 const { data : frontmatter , content : markdownContent } = matter ( content ) ;
7877
79- // Try to get title from frontmatter first, then h1 header, then filename
8078 let title = frontmatter . title ;
8179 if ( ! title ) {
82- // Look for first h1 header in markdown content
8380 const headerMatch = markdownContent . match ( / ^ # \s + ( .+ ) $ / m) ;
8481 title = headerMatch ? headerMatch [ 1 ] . trim ( ) : fileName ;
8582 }
@@ -93,7 +90,7 @@ module.exports = function (
9390 }
9491 }
9592
96- // Do the same for blog posts
93+ // Load blog posts
9794 const blogDir = path . join ( context . siteDir , 'blog' ) ;
9895 if ( fs . existsSync ( blogDir ) ) {
9996 const blogFiles = getMarkdownFiles ( blogDir ) ;
@@ -108,10 +105,8 @@ module.exports = function (
108105 const matter = require ( 'gray-matter' ) ;
109106 const { data : frontmatter , content : markdownContent } = matter ( content ) ;
110107
111- // Try to get title from frontmatter first, then h1 header, then filename
112108 let title = frontmatter . title ;
113109 if ( ! title ) {
114- // Look for first h1 header in markdown content
115110 const headerMatch = markdownContent . match ( / ^ # \s + ( .+ ) $ / m) ;
116111 title = headerMatch ? headerMatch [ 1 ] . trim ( ) : fileName ;
117112 }
@@ -125,6 +120,36 @@ module.exports = function (
125120 }
126121 }
127122
123+ // Load releases
124+ const releasesDir = path . join ( context . siteDir , 'releases' ) ;
125+ if ( fs . existsSync ( releasesDir ) ) {
126+ const releaseFiles = getMarkdownFiles ( releasesDir ) ;
127+ console . log ( 'Found release files:' , releaseFiles . length ) ;
128+
129+ for ( const file of releaseFiles ) {
130+ const content = fs . readFileSync ( file , 'utf8' ) ;
131+ const relativePath = path . relative ( releasesDir , file ) ;
132+ const fileNameMatch = file . match ( / ( [ ^ / ] + ) \. m d x ? $ / ) ;
133+ const fileName = fileNameMatch ? fileNameMatch [ 1 ] : '' ;
134+
135+ const matter = require ( 'gray-matter' ) ;
136+ const { data : frontmatter , content : markdownContent } = matter ( content ) ;
137+
138+ let title = frontmatter . title ;
139+ if ( ! title ) {
140+ const headerMatch = markdownContent . match ( / ^ # \s + ( .+ ) $ / m) ;
141+ title = headerMatch ? headerMatch [ 1 ] . trim ( ) : fileName ;
142+ }
143+
144+ items . push ( {
145+ title,
146+ description : frontmatter . description || '' ,
147+ permalink : `/releases/${ relativePath . replace ( / \. m d x ? $ / , '' ) } /` ,
148+ sectionNesting : 0
149+ } ) ;
150+ }
151+ }
152+
128153 } catch ( error ) {
129154 console . error ( 'Error loading content:' , error ) ;
130155 }
@@ -162,12 +187,35 @@ This file contains links to all documentation pages, blog posts, and other conte
162187
163188` ;
164189
165- // Add docs with proper nesting
190+ // Add docs without indentation
191+ this . content . forEach ( doc => {
192+ if ( doc . permalink . startsWith ( '/docs/' ) ) {
193+ markdownContent += `- [${ doc . title } ](${ context . siteConfig . url } ${ context . siteConfig . baseUrl } ${ doc . permalink } )\n` ;
194+ if ( doc . description ) {
195+ markdownContent += ` ${ doc . description } \n` ;
196+ }
197+ }
198+ } ) ;
199+
200+ // Add Developer Blog section
201+ markdownContent += `\n## Developer Blog\n\n` ;
202+ this . content . forEach ( doc => {
203+ if ( doc . permalink . startsWith ( '/blog/' ) ) {
204+ markdownContent += `- [${ doc . title } ](${ context . siteConfig . url } ${ context . siteConfig . baseUrl } ${ doc . permalink } )\n` ;
205+ if ( doc . description ) {
206+ markdownContent += ` ${ doc . description } \n` ;
207+ }
208+ }
209+ } ) ;
210+
211+ // Add Releases section
212+ markdownContent += `\n## Releases\n\n` ;
166213 this . content . forEach ( doc => {
167- const indent = ' ' . repeat ( doc . sectionNesting ) ;
168- markdownContent += `${ indent } - [${ doc . title } ](${ context . siteConfig . url } ${ context . siteConfig . baseUrl } ${ doc . permalink } )\n` ;
169- if ( doc . description ) {
170- markdownContent += `${ indent } ${ doc . description } \n` ;
214+ if ( doc . permalink . startsWith ( '/releases/' ) ) {
215+ markdownContent += `- [${ doc . title } ](${ context . siteConfig . url } ${ context . siteConfig . baseUrl } ${ doc . permalink } )\n` ;
216+ if ( doc . description ) {
217+ markdownContent += ` ${ doc . description } \n` ;
218+ }
171219 }
172220 } ) ;
173221
0 commit comments