In my Next.js App, I have create a multi theme project in one project. All thing well done except SEO part, I have import the theme dynamically with next/dynamic, when I have set load the theme in static mode all things are well done like code below
import React from 'react';
import Head from 'next/head';
import dynamic from 'next/dynamic';
import { ISiteInfo } from 'services/interfaces/siteinfo';
import { getImage } from 'utils';
interface IProps {
siteInfo: ISiteInfo;
renderComp(props): any;
}
const Home: React.FC<IProps> = ({ siteInfo }) => {
let TemplateSelected = undefined;
const id = '5fd739bf4e1cc93357419479';
TemplateSelected = dynamic(() => import('../components/' + id));
return (
<>
<Head>
<title>{siteInfo?.title}</title>
<link rel="icon" href={getImage(siteInfo?.favIcon?.hash, 'original')} />
</Head>
{siteInfo?.template && <TemplateSelected siteInfo={siteInfo} />}
</>
);
};
export default Home;
but when change the load theme component way and make it dynamically, it's not display the code on the view source page:
let TemplateSelected = undefined;
const id = siteInfo?.template;
TemplateSelected = dynamic(() => import('../components/' + id));
I haven't any idea to how to solve it.