Files
myeasycms-v2/apps/web/app/(marketing)/docs/page.tsx
giancarlo 53afd10f32 Update content categorization and handle hierarchical documentation
Enhancements were implemented to support hierarchical documentation. Local CMS now respects parent ID and order attributes of content items, and content can be categories as 'blog' or 'documentation'. Changes were also made to the wordpress integration supporting these new categorizations. Introduced working with nested documentation pages.
2024-04-03 21:06:54 +08:00

43 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({
categories: ['documentation'],
});
// Filter out any docs that have a parentId, as these are children of other docs
const cards = docs.filter((item) => !item.parentId);
return (
<div className={'my-8 flex flex-col space-y-16'}>
<SitePageHeader
title={t('marketing:documentation')}
subtitle={t('marketing:documentationSubtitle')}
/>
<PageBody>
<DocsCards cards={cards} />
</PageBody>
</div>
);
}
export default withI18n(DocsPage);