@@ -56,6 +56,7 @@ export function DetailsRoutes() {
56
56
export function OtherPageRoutes ( ) {
57
57
const dir = assertDefined ( useParams ( ) . dir ) ;
58
58
const { '*' : path } = useParams ( ) ;
59
+ const { layoutParameters, setLayoutParameters} = useLayoutContext ( ) ;
59
60
60
61
if ( [ 'books' , 'textbooks' ] . includes ( dir ) ) {
61
62
return (
@@ -76,26 +77,53 @@ export function OtherPageRoutes() {
76
77
return < Navigate to = "/" replace /> ;
77
78
}
78
79
80
+ // Some pages have no page data in the CMS!
81
+ if (
82
+ [
83
+ 'adopters' ,
84
+ 'adoption' ,
85
+ 'blog' ,
86
+ 'campaign' ,
87
+ 'confirmation' ,
88
+ 'institutional-partnership-application' ,
89
+ 'interest' ,
90
+ 'renewal-form' ,
91
+ 'separatemap'
92
+ ] . includes ( dir )
93
+ ) {
94
+ if ( layoutParameters . name === null ) {
95
+ setLayoutParameters ( { name : 'default' } ) ;
96
+ }
97
+ return < ImportedPage name = { dir } /> ;
98
+ }
99
+
79
100
return < RouteAsPortalOrNot /> ;
80
101
}
81
102
82
-
83
103
// There are a couple of pages whose names in the CMS don't match their osweb urls
84
104
const mismatch : Record < string , string > = {
85
105
press : 'news' ,
86
- 'edtech-partner-program' : 'openstax-ally-technology-partner-program'
106
+ 'edtech-partner-program' : 'openstax-ally-technology-partner-program' ,
107
+ foundation : 'supporters'
87
108
} ;
88
109
89
110
export function usePageDataFromRoute ( ) {
90
111
const { dir : name , '*' : other } = useParams ( ) ;
91
- const data = usePageData < PageData > ( `pages/${ mismatch [ name as string ] ?? name } ` , true ) ;
112
+ const data = usePageData < PageData > (
113
+ `pages/${ mismatch [ name as string ] ?? name } ` ,
114
+ true
115
+ ) ;
92
116
const hasError = data && 'error' in data ;
93
117
94
118
return { name, data, hasError, other} ;
95
119
}
96
120
97
121
export function FlexPageUsingItsOwnLayout ( { data} : { data : FlexPageData } ) {
98
- return < LayoutUsingData data = { data } > < FlexPage data = { data } /> </ LayoutUsingData > ;
122
+ return (
123
+ < LayoutUsingData data = { data } >
124
+ < FlexPage data = { data } />
125
+ </ LayoutUsingData >
126
+ ) ;
99
127
}
100
128
101
129
export function NonFlexPageUsingDefaultLayout ( { data} : { data : PageData } ) {
0 commit comments