Files
myeasycms-v2/apps/web/app/(marketing)/blog/page.tsx
giancarlo 048d58dcdf 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.
2024-04-03 16:05:34 +08:00

45 lines
1.2 KiB
TypeScript

import { createCmsClient } from '@kit/cms';
import { GridList } from '~/(marketing)/_components/grid-list';
import { SitePageHeader } from '~/(marketing)/_components/site-page-header';
import { PostPreview } from '~/(marketing)/blog/_components/post-preview';
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
import { withI18n } from '~/lib/i18n/with-i18n';
export const generateMetadata = async () => {
const { t } = await createI18nServerInstance();
return {
title: t('marketing:blog'),
description: t('marketing:blogSubtitle'),
};
};
async function BlogPage() {
const { t } = await createI18nServerInstance();
const cms = await createCmsClient();
const posts = await cms.getContentItems({
type: 'post',
});
return (
<div className={'container mx-auto'}>
<div className={'my-8 flex flex-col space-y-16'}>
<SitePageHeader
title={t('marketing:blog')}
subtitle={t('marketing:blogSubtitle')}
/>
<GridList>
{posts.map((post, idx) => {
return <PostPreview key={idx} post={post} />;
})}
</GridList>
</div>
</div>
);
}
export default withI18n(BlogPage);