@@ -50,6 +50,7 @@ type NxDocumentationProps =
50
50
| {
51
51
pageType :
52
52
| 'generators-index'
53
+ | 'legacy-documents-index'
53
54
| 'executors-index'
54
55
| 'generators'
55
56
| 'executors' ;
@@ -111,6 +112,8 @@ export default function NxDocumentation(props: NxDocumentationProps) {
111
112
< PackageSchemaSubList pkg = { props . pkg } type = "generator" />
112
113
) : props . pageType === 'executors-index' ? (
113
114
< PackageSchemaSubList pkg = { props . pkg } type = "executor" />
115
+ ) : props . pageType === 'legacy-documents-index' ? (
116
+ < PackageSchemaSubList pkg = { props . pkg } type = "document" />
114
117
) : props . pageType === 'legacy-documents' ? (
115
118
< DocViewer
116
119
document = { props . document }
@@ -205,29 +208,40 @@ export const getStaticProps: GetStaticProps = async ({
205
208
}
206
209
return { props } ;
207
210
} else if ( type === 'documents' ) {
208
- const _segments = [ 'nx-api' , packageName , 'documents' , ...segments ] ;
209
- const documents = new DocumentsApi ( {
210
- id : [ packageName , 'documents' ] . join ( '-' ) ,
211
- manifest : nxPackagesApi . getPackageDocuments ( packageName ) ,
212
- prefix : '' ,
213
- publicDocsRoot : 'public/documentation' ,
214
- tagsApi,
215
- } ) ;
216
- const document = documents . getDocument ( _segments ) ;
217
- return {
218
- props : {
219
- pageType : 'legacy-documents' ,
220
- pkg : nxPackagesApi . getPackage ( [ packageName ] ) ,
221
- document,
222
- widgetData : {
223
- githubStarsCount : await fetchGithubStarCount ( ) ,
211
+ const isList = segments . length === 0 ;
212
+ if ( isList ) {
213
+ return {
214
+ props : {
215
+ pageType : 'legacy-documents-index' ,
216
+ pkg : nxPackagesApi . getPackage ( [ packageName ] ) ,
217
+ menu,
224
218
} ,
225
- relatedDocuments : tagsApi
226
- . getAssociatedItemsFromTags ( document . tags )
227
- . filter ( ( item ) => item . path !== '/' + _segments . join ( '/' ) ) , // Remove currently displayed item
228
- menu,
229
- } ,
230
- } ;
219
+ } ;
220
+ } else {
221
+ const _segments = [ 'nx-api' , packageName , 'documents' , ...segments ] ;
222
+ const documents = new DocumentsApi ( {
223
+ id : [ packageName , 'documents' ] . join ( '-' ) ,
224
+ manifest : nxPackagesApi . getPackageDocuments ( packageName ) ,
225
+ prefix : '' ,
226
+ publicDocsRoot : 'public/documentation' ,
227
+ tagsApi,
228
+ } ) ;
229
+ const document = documents . getDocument ( _segments ) ;
230
+ return {
231
+ props : {
232
+ pageType : 'legacy-documents' ,
233
+ pkg : nxPackagesApi . getPackage ( [ packageName ] ) ,
234
+ document,
235
+ widgetData : {
236
+ githubStarsCount : await fetchGithubStarCount ( ) ,
237
+ } ,
238
+ relatedDocuments : tagsApi
239
+ . getAssociatedItemsFromTags ( document . tags )
240
+ . filter ( ( item ) => item . path !== '/' + _segments . join ( '/' ) ) , // Remove currently displayed item
241
+ menu,
242
+ } ,
243
+ } ;
244
+ }
231
245
} else if ( type === 'migrations' ) {
232
246
// API migrations
233
247
// Example: /technologies/typescript/api/migrations
0 commit comments