This is a Tina CMS project which uses a separate repo to store the CMS content. Originally suggested here.
You might want to do this for a variety of reasons, such as:
- To decouple your website code from your content files so your commit history isn't a mix of content updates and code updates
- To avoid having to give Tina Cloud write access to your website's code (only give access to your content repo)
Using a separate content repo works by defining your config in the repo you'll use for editing with the CMS (which is this repo). We'll call that the "website repo".
To set up the "content repo", we'll start with a simple .mdx
file:
mkdir -p ../demo-content-repo/content/pages && touch ../demo-content-repo/content/pages/home.mdx && echo "Hello" >> ../demo-content-repo/content/pages/home.mdx
Install the project's dependencies:
yarn install
Run the project locally:
yarn dev
Open http://localhost:3000/admin/index.html
From here you can add more fields to you content models in .tina/config.js
. Visit the docs to learn more about content modeling.
Since your content is in a separate repo, we'll want to use that repo to connect to Tina Cloud.
Initialize Git in your content repo and push it to Github. From there connect to Tina Cloud
Once that's done, create a token for the main
branch, or use *
to allow all branches.
Switch back to this repo (your "website repo") and set up an .env
file to use when connecting to Tina Cloud
cp .env.example .env
When you run tinacms build
, it will use those credentials to connect to Tina Cloud rather than the local server:
yarn build
To learn more about Tina, take a look at the following resources:
You can check out Tina Github repository - your feedback and contributions are welcome!