Files
myeasycms-v2/apps/web/app/(marketing)/docs/page.tsx
giancarlo 44373c0372 Update CMS client configuration and refactor content organization
The code changes involve a significant update to the configuration of our CMS client. The nature of retrieving content items has been refactored to be more granular, allowing for the identification and fetching of content from specified collections rather than general categories. These modifications improve the efficiency and specificity of content queries. Furthermore, other changes were made to provide a better alignment of our content structure, including the reorganization of content files and renaming of image paths in various components for consistency.
2024-04-10 15:52:26 +08:00

45 lines
1.2 KiB
TypeScript

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 { 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:documentation'),
};
};
async function DocsPage() {
const client = await createCmsClient();
const { t } = await createI18nServerInstance();
const docs = await client.getContentItems({
collection: 'documentation',
});
// Filter out any docs that have a parentId, as these are children of other docs
const cards = docs.filter((item) => !item.parentId);
return (
<PageBody>
<div className={'flex flex-col space-y-12 xl:space-y-24'}>
<SitePageHeader
title={t('marketing:documentation')}
subtitle={t('marketing:documentationSubtitle')}
/>
<div className={'flex flex-col items-center'}>
<DocsCards cards={cards} />
</div>
</div>
</PageBody>
);
}
export default withI18n(DocsPage);