File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { RenderBlocks } from '@codeware/shared/ui/payload-components' ;
2+ import type { SiteSetting } from '@codeware/shared/util/payload-types' ;
23import { type MetaFunction , useRouteError } from '@remix-run/react' ;
34
45import { Container } from '../components/container' ;
@@ -10,10 +11,22 @@ type LoaderError = {
1011 status : number ;
1112} ;
1213
13- // TODO: How to use it properly?
14- export const meta : MetaFunction = ( ) => {
15- const { landingPage } = useSiteSettings ( ) ;
16- return [ { title : landingPage ?. name } ] ;
14+ export const meta : MetaFunction = ( { matches } ) => {
15+ // Get loading page from root loader data
16+ const rootData = matches . find ( ( match ) => match . id === 'root' ) ?. data as Record <
17+ string ,
18+ SiteSetting
19+ > ;
20+
21+ let title = 'Home' ;
22+
23+ if ( rootData && 'siteSettings' in rootData ) {
24+ if ( typeof rootData . siteSettings . general . landingPage === 'object' ) {
25+ title = rootData . siteSettings . general . landingPage . meta ?. title ?? title ;
26+ }
27+ }
28+
29+ return [ { title } ] ;
1730} ;
1831
1932export default function Index ( ) {
You can’t perform that action at this time.
0 commit comments