1. Swap out the required dependencies
Remove the existing dependencies…Terminal
Terminal
2. Update the .gitignore file
Add .content-collections to the .gitignore file:
apps/web/.gitignore
3. Modify the CMS package scripts
Now we need to modify the CMS package scripts to replace thebasehub commands with content-collections.
packages/cms/package.json
We’re using the Content Collections CLI directly to generate the collections prior to Next.js processes. The files are cached and not rebuilt in the Next.js build process. This is a workaround for this issue.
4. Modify the relevant CMS package files
5. Update the sitemap.ts file
Update the sitemap.ts file to scan the content directory for MDX files:
apps/web/app/sitemap.ts
6. Create your collections
Create a new content collections file in thecms package, then import the collections in the web package.
We’re remapping the
title field to _title and the _meta.path field to _slug to match the default JTBDOS CMS.7. Create your content
To create a new blog post, add a new MDX file to theapps/web/content/blog directory. The file name will be used as the slug for the blog post and the frontmatter will be used to generate the blog post page. For example:
apps/web/content/blog/my-first-post.mdx
legal collection, which is used to generate the legal policy pages. Also, the image field is the path relative to the app’s root public directory.
8. Remove the environment variables
Finally, remove all instances ofBASEHUB_TOKEN from the @repo/env package.