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.
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
import { allDocumentationPages } from 'contentlayer/generated';
|
||||
import { createCmsClient } from '@kit/cms';
|
||||
|
||||
import DocsNavigation from '~/(marketing)/docs/_components/docs-navigation';
|
||||
import { buildDocumentationTree } from '~/(marketing)/docs/_lib/build-documentation-tree';
|
||||
import { DocsNavigation } from '~/(marketing)/docs/_components/docs-navigation';
|
||||
|
||||
function DocsLayout({ children }: React.PropsWithChildren) {
|
||||
const tree = buildDocumentationTree(allDocumentationPages);
|
||||
async function DocsLayout({ children }: React.PropsWithChildren) {
|
||||
const cms = await createCmsClient();
|
||||
|
||||
const pages = await cms.getContentItems({
|
||||
type: 'page',
|
||||
categories: ['documentation'],
|
||||
depth: 1,
|
||||
});
|
||||
|
||||
console.log(pages);
|
||||
|
||||
return (
|
||||
<div className={'container mx-auto'}>
|
||||
<div className={'flex'}>
|
||||
<DocsNavigation tree={tree} />
|
||||
<DocsNavigation pages={pages} />
|
||||
|
||||
<div className={'flex w-full flex-col items-center'}>{children}</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user