The changes involved modifying the implementation of `getContentItems` across multiple files, specifically in the CMS-related codebase. This method now returns an object containing the total count of items and the items themselves. The updates also included necessary adjustments in the code where `getContentItems` is called to accommodate the new structure of the returned result.
45 lines
1.3 KiB
TypeScript
45 lines
1.3 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 { items } = await client.getContentItems({
|
|
collection: 'documentation',
|
|
});
|
|
|
|
// Filter out any docs that have a parentId, as these are children of other docs
|
|
const cards = items.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={'container mx-auto flex flex-col items-center'}>
|
|
<DocsCards cards={cards} />
|
|
</div>
|
|
</div>
|
|
</PageBody>
|
|
);
|
|
}
|
|
|
|
export default withI18n(DocsPage);
|