Files
myeasycms-v2/apps/web/app/(marketing)/blog/page.tsx
giancarlo 6b72206b00 Refactor CMS to handle ContentLayer and WordPress platforms
This commit refactors the CMS to handle two platforms: ContentLayer and WordPress. The CMS layer is abstracted into a core package, and separate implementations for each platform are created. This change allows the app to switch the CMS type based on environment variable, which can improve the flexibility of content management. It also updates several functions in the `server-sitemap.xml` route to accommodate these changes and generate sitemaps based on the CMS client. Further, documentation content and posts have been relocated to align with the new structure. Notably, this refactor is a comprehensive update to the way the CMS is structured and managed.
2024-04-01 19:47:51 +08:00

42 lines
1.1 KiB
TypeScript

import type { Metadata } from 'next';
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 appConfig from '~/config/app.config';
import { withI18n } from '~/lib/i18n/with-i18n';
export const metadata: Metadata = {
title: `Blog - ${appConfig.name}`,
description: `Tutorials, Guides and Updates from our team`,
};
async function BlogPage() {
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={'Blog'}
subtitle={'Tutorials, Guides and Updates from our team'}
/>
<GridList>
{posts.map((post, idx) => {
return <PostPreview key={idx} post={post} />;
})}
</GridList>
</div>
</div>
);
}
export default withI18n(BlogPage);