Implement internationalization in pages and update CMS clients

The commit mainly revamps the code to support internationalization in various pages like pricing, docs, blog, etc. It modifies the code to generate metadata asynchronously, accommodating internationalized page titles and subtitles. Also, the commit restructures CMS Client scripts, particularly for ContentLayer and Wordpress. For Wordpress, it updates API fetch routes and handles embedded children data. Furthermore, unnecessary logging statements are cleaned up, and minor updates are done for better UI and code efficiency.
This commit is contained in:
giancarlo
2024-04-03 16:05:34 +08:00
parent 12058274f5
commit 048d58dcdf
28 changed files with 227 additions and 157 deletions

View File

@@ -1,16 +1,22 @@
import { createCmsClient } from '@kit/cms';
import { PageBody } from '@kit/ui/page';
import { SitePageHeader } from '~/(marketing)/_components/site-page-header';
import { DocsCards } from '~/(marketing)/docs/_components/docs-cards';
import appConfig from '~/config/app.config';
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
import { withI18n } from '~/lib/i18n/with-i18n';
export const metadata = {
title: `Documentation - ${appConfig.name}`,
export const generateMetadata = async () => {
const { t } = await createI18nServerInstance();
return {
title: t('marketing:documentation'),
};
};
async function DocsPage() {
const client = await createCmsClient();
const { t } = await createI18nServerInstance();
const docs = await client.getContentItems({
type: 'page',
@@ -18,18 +24,16 @@ async function DocsPage() {
depth: 1,
});
console.log(docs);
return (
<div className={'my-8 flex flex-col space-y-16'}>
<SitePageHeader
title={'Documentation'}
subtitle={'Get started with our guides and tutorials'}
title={t('marketing:documentation')}
subtitle={t('marketing:documentationSubtitle')}
/>
<div>
<PageBody>
<DocsCards pages={docs} />
</div>
</PageBody>
</div>
);
}