This is a Tina CMS starter project.
npx create-tina-app@latest --template tina-astro-starter
And start editing with TinaCMS at /admin
!
π§βπ Seasoned astronaut? Delete this file. Have fun!
Features:
- β Markdown & MDX support + TinaCMS Markdown Component
- β TinaCMS Collections (Pages, Blogs, Config)
- β Visual Editing using Custom Loaders and Client Directives
- β 100/100 Lighthouse performance
- β View transitions are enabled
- β Minimal styling (make it your own!)
- β SEO-friendly with canonical URLs and OpenGraph data
- β Sitemap support
- β RSS Feed support
Inside of your project, you'll see the following folders and files:
βββ README.md
βββ astro-tina-directive/
βββ astro.config.mjs
βββ package.json
βββ pnpm-lock.yaml
βββ public/
βββ src
β βββ components
β βββ content
β βββ content.config.ts
β βββ layouts
β βββ pages
β βββ styles
βββ tina
β βββ collections
β βββ components
β βββ config.ts
β βββ pages
β βββ tina-lock.json
βββ tsconfig.json
Each page is exposed as a route based on its file name which are generated from the content under src/content/
(excluding the config
folder).
To enable Visual Editing with TinaCMS we have had to use React components and a new client:tina
Directive. Which is the code located under astro-tina-directive
.
Under the tina/
folder we have, collections/
which holds our TinaCMS schema definitions. Under components/
we have a custom Icon Component that is used within the TinaCMS UI. Under pages/
we have the "wrappers" that make the Visual Editing work, using the useTina
hook.
The pages/index.astro
is the "Home" page - This is a special case and has been setup to look for the content/page/home.mdx
file.
There's nothing special about src/components/
, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
The src/content/
directory contains "collections" of related Markdown and MDX documents. Use getCollection()
to retrieve posts from src/content/blog/
, and type-check your frontmatter using an optional schema. See Astro's Content Collections docs to learn more.
Note
To use getCollection()
we need to add a schema in content.config.ts
with a custom loader that uses the correct TinaCMS Collection.
Any static assets, like images, can be placed in the public/
directory.
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:4321 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add , astro check |
npm run astro -- --help |
Get help using the Astro CLI |
Check out the TinaCMS documentation and the Astro documentation or jump into our TinaCMS Discord server.
This theme is based off of the lovely Bear Blog.