This repository was archived by the owner on Feb 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { algoliaIndexName } from '@/api/algolia/connector'
2
2
import getPostTypeById from './getPostTypeById'
3
- import getPostTypeArchive from './getPostTypeArchive'
3
+ import getPostTypeArchive , { archiveQuerySeo } from './getPostTypeArchive'
4
4
import { addApolloState } from '@/api/apolloConfig'
5
5
import getFrontendPage , { frontendPageSeo } from './getFrontendPage'
6
6
import getSettingsCustomPage , {
7
7
customPageQuerySeo
8
8
} from './getSettingsCustomPage'
9
+ import getPostTypeTaxonomyArchive from './getPostTypeTaxonomyArchive'
9
10
10
11
/**
11
12
* Retrieve static props by post type.
@@ -75,6 +76,30 @@ export default async function getPostTypeStaticProps(
75
76
} )
76
77
}
77
78
79
+ /* -- Handle taxonomy archives. -- */
80
+ if (
81
+ Object . keys ( archiveQuerySeo ) . includes ( postType ) &&
82
+ params . slug . length > 1
83
+ ) {
84
+ const taxonomy = params . slug . shift ( )
85
+ const taxonomySlug = params . slug . join ( '/' )
86
+
87
+ const { apolloClient, ...archiveData } = await getPostTypeTaxonomyArchive (
88
+ taxonomy ,
89
+ taxonomySlug
90
+ )
91
+
92
+ // Merge in query results as Apollo state.
93
+ return addApolloState ( apolloClient , {
94
+ props : {
95
+ ...archiveData ,
96
+ ...sharedProps ,
97
+ archive : true
98
+ } ,
99
+ revalidate
100
+ } )
101
+ }
102
+
78
103
/* -- Handle individual posts. -- */
79
104
80
105
// Handle catch-all routes.
You can’t perform that action at this time.
0 commit comments