File tree 1 file changed +7
-15
lines changed
src/pages/[locale]/[...path]
1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- import { datocmsCollection , datocmsRequest } from ' @lib/datocms' ;
2
+ import { getCollection } from ' @lib/collections' ;
3
+ import { datocmsRequest } from ' @lib/datocms' ;
3
4
import { getPageHref } from ' @lib/routing/' ;
4
5
import {
5
6
getPagePath ,
6
7
getPageSlugFromPath ,
7
8
getParentPages ,
8
9
} from ' @lib/routing/page' ;
9
10
import {
10
- PageRoute as fragment ,
11
- type PageQuery ,
12
- type PageRouteFragment ,
11
+ type PageQuery ,
13
12
type SiteLocale
14
13
} from ' @lib/datocms/types' ;
15
14
import type { PageUrl } from ' @lib/seo' ;
@@ -21,17 +20,10 @@ import PreviewModeSubscription from '@components/PreviewMode/PreviewModeSubscrip
21
20
import query from ' ./_index.query.graphql' ;
22
21
23
22
export async function getStaticPaths() {
24
- const pages = await datocmsCollection <PageRouteFragment >({
25
- collection: ' Pages' ,
26
- fragment ,
27
- });
28
- return pages .flatMap ((page ) => {
29
- const locales = page ._allSlugLocales
30
- ?.map ((slug ) => slug .locale )
31
- .filter ((locale ) => !! locale );
32
- return locales ?.map ((locale ) => {
33
- return { params: { locale , path: getPagePath ({ page , locale }) } };
34
- });
23
+ const pages = await getCollection (' Pages' );
24
+ return pages .map (({ data : page }) => {
25
+ const { locale } = page ;
26
+ return { params: { locale , path: getPagePath ({ page , locale }) } };
35
27
});
36
28
}
37
29
You can’t perform that action at this time.
0 commit comments