Home
Blog
Showcase
Community
Introduction
Overview
Introduction To TinaCMS
Getting Started
Overview
Using a Starter
Framework-Specific Guides
Next.js
Astro
Hugo
Gatsby
Jekyll
Remix
11ty
Other
Using the Tina Editor
FAQ
Core Concepts
Content Modeling
Data Fetching
Visual Editing
Querying Content
Overview
Writing custom queries
Editing
Overview
Markdown & MDX
Block-based editing
Single Document Collections
Customizing Tina
Overview
Validation
Custom Field Components
Custom List Rendering
Format and Parse Input
Filename Customization
Before Submit function
Going To Production
Overview
Tina Cloud
Self-Hosted
Drafts
Overview
Draft Fields
Editorial Workflow
Guides
Overview
Framework Guides
Separate Content Repo
Querying Tina Content at Runtime
Internationalization
Migrating From Forestry
Further Reference
Overview
Config
Schema
The "tina" folder
The TinaCMS CLI
Media
Search
Content API
Tina's edit state
The "tinaField" helper
Self-Hosted Components

Introduction

TinaCMS can be added to your Gatsby site locally. In this doc, we'll guide through the local setup, as well as editing on your production site.

Getting Started

From within your site's directory, run:

npx @tinacms/cli@latest init

This will ask you a few setup questions.

When prompted for the "public assets directory", enter: static.

If you are importing your site from Forestry.io CMS, some models & config will be auto-imported.

Workaround for GraphQL Mismatch issue

For Gatsby sites, you may run into the following error:

> "Duplicate "graphql" modules cannot be used at the same time since different versions may have different capabilities and behavior."

To work around this, add the following lines to your tina/config.ts file.

export default defineConfig({
+ client: { skip: true },
// ...

Allowing static /admin/index.html file in dev-mode

Depending on your Gatsby version, you may need to add the following code to your gatsby-node.js file, so that the Tina admin is accessible in dev-mode.

+ const express = require("express");
+ exports.onCreateDevServer = ({ app }) => {
+ app.use("/admin", express.static("public/admin"));
+ };

Model your content

To edit your site's content in Tina, you can model your content in the tina/config.ts file.

Learn more about content modelling here

Starting TinaCMS

You can start TinaCMS with:

npx tinacms dev -c "gatsby develop"
gatsby developcan be replaced with your site's custom dev command.

With TinaCMS running, navigate to http://localhost:8000/admin/index.html

^ The above default port may differ depending on your framework.
Hint: One common error is caused by running gatsby clean after tinacms build. This causes your admin html file to be wiped out. For more common errors, please see the Common Errors page.

At this point, you should be able to see the Tina admin, select a post, save changes, and see the changes persisted to your local markdown files.

Setting up Visual Editing (Optional)

If you want to power your pages with TinaCMS's API, you'll be able to leverage TinaCMS's visual editing features.

block-based-editing-visual

Read more about data fetching and visual editing.

Note: Visual Editing with Gatsby is considered experimental.

Next Steps

Previous
Hugo + TinaCMS Setup Guide
Next
Jekyll + TinaCMS Setup Guide

Product

Showcase
TinaCloud
Introduction
How Tina Works
Roadmap

Resources

Blog
Examples
Support
Media

Whats New
TinaCMS
TinaCloud
Use Cases
Agencies
Documentation
Teams
Jamstack CMS
Benefits
MDX
Markdown
Git
Editorial Workflow
Customization
SEO
Comparisons
TinaCMS vs Storyblok
TinaCMS vs Sanity
TinaCMS vs DecapCMS
TinaCMS vs Contentful
TinaCMS vs Builder.io
TinaCMS vs Strapi
Integrations
Astro
Hugo
NextJS
Jekyll