Giter VIP home page Giter VIP logo

tina.io-separate-website-repo's Introduction

This is a Tina CMS project which uses a separate repo to store the CMS content. Originally suggested here.

Why?

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)

Create the content repository

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

Local Development

Install the project's dependencies:

yarn install

Run the project locally:

yarn dev

Visit the page in edit mode

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.

Deploying your content repo

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

Learn More

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!

tina.io-separate-website-repo's People

Contributors

jeffsee55 avatar scottgallant avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.