Initial commit
This commit is contained in:
17
templates/astro/.env.example
Normal file
17
templates/astro/.env.example
Normal file
@@ -0,0 +1,17 @@
|
||||
# TinaCloud Credentials
|
||||
# Get these from https://app.tina.io after creating a project
|
||||
|
||||
# Note: Astro requires PUBLIC_ prefix for client-exposed variables
|
||||
|
||||
# Client ID (public, safe to expose)
|
||||
PUBLIC_TINA_CLIENT_ID=your_client_id_here
|
||||
|
||||
# Read-only token (keep secret, NOT public)
|
||||
# This should not have PUBLIC_ prefix as it's server-side only
|
||||
TINA_TOKEN=your_read_only_token_here
|
||||
|
||||
# Git branch
|
||||
PUBLIC_GITHUB_BRANCH=main
|
||||
|
||||
# For self-hosted backend
|
||||
# PUBLIC_TINA_API_URL=/api/tina/gql
|
||||
29
templates/astro/astro.config.mjs
Normal file
29
templates/astro/astro.config.mjs
Normal file
@@ -0,0 +1,29 @@
|
||||
import { defineConfig } from 'astro/config'
|
||||
import react from '@astro/react'
|
||||
import mdx from '@astro/mdx'
|
||||
|
||||
/**
|
||||
* Astro Configuration for TinaCMS
|
||||
*
|
||||
* Key settings:
|
||||
* - React integration (required for Tina admin interface)
|
||||
* - MDX support (for rich content)
|
||||
* - Site configuration
|
||||
*
|
||||
* For more info: https://astro.build/config
|
||||
*/
|
||||
export default defineConfig({
|
||||
integrations: [
|
||||
react(), // Required for TinaCMS admin
|
||||
mdx(), // Recommended for rich content
|
||||
],
|
||||
|
||||
// Your site URL (for sitemap, canonical URLs, etc.)
|
||||
site: 'https://example.com',
|
||||
|
||||
// Optional: Server configuration
|
||||
server: {
|
||||
port: 4321,
|
||||
host: '0.0.0.0', // Allows external connections (Docker, network)
|
||||
},
|
||||
})
|
||||
25
templates/astro/package.json
Normal file
25
templates/astro/package.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "astro-tinacms-app",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "tinacms dev -c \"astro dev\"",
|
||||
"build": "tinacms build && astro build",
|
||||
"preview": "astro preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/mdx": "^4.0.0",
|
||||
"@astrojs/react": "^4.0.0",
|
||||
"astro": "^5.15.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0",
|
||||
"tinacms": "^2.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tinacms/cli": "^1.11.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"typescript": "^5.6.0"
|
||||
}
|
||||
}
|
||||
65
templates/astro/tina-config.ts
Normal file
65
templates/astro/tina-config.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { defineConfig } from 'tinacms'
|
||||
import { blogPostCollection } from './collections/blog-post'
|
||||
import { docPageCollection } from './collections/doc-page'
|
||||
import { authorCollection } from './collections/author'
|
||||
|
||||
/**
|
||||
* TinaCMS Configuration for Astro
|
||||
*
|
||||
* This config works with Astro static site generator.
|
||||
*
|
||||
* Key Points:
|
||||
* - Visual editing is experimental (requires React components)
|
||||
* - Best for content-focused static sites
|
||||
* - Environment variables use PUBLIC_ prefix
|
||||
* - Admin interface requires React integration
|
||||
*
|
||||
* Usage:
|
||||
* 1. Copy this file to: tina/config.ts
|
||||
* 2. Copy collection files to: tina/collections/
|
||||
* 3. Set environment variables in .env
|
||||
* 4. Run: npm run dev
|
||||
* 5. Access admin: http://localhost:4321/admin/index.html
|
||||
*/
|
||||
|
||||
// Get Git branch from environment
|
||||
const branch =
|
||||
process.env.PUBLIC_GITHUB_BRANCH ||
|
||||
process.env.PUBLIC_VERCEL_GIT_COMMIT_REF ||
|
||||
'main'
|
||||
|
||||
export default defineConfig({
|
||||
// Git branch to use
|
||||
branch,
|
||||
|
||||
// TinaCloud credentials
|
||||
// Note: Astro requires PUBLIC_ prefix for client-exposed variables
|
||||
clientId: process.env.PUBLIC_TINA_CLIENT_ID,
|
||||
token: process.env.TINA_TOKEN,
|
||||
|
||||
// Build configuration
|
||||
build: {
|
||||
outputFolder: 'admin',
|
||||
publicFolder: 'public',
|
||||
},
|
||||
|
||||
// Media configuration
|
||||
media: {
|
||||
tina: {
|
||||
mediaRoot: 'uploads',
|
||||
publicFolder: 'public',
|
||||
},
|
||||
},
|
||||
|
||||
// Content schema
|
||||
schema: {
|
||||
collections: [
|
||||
blogPostCollection,
|
||||
authorCollection,
|
||||
docPageCollection,
|
||||
],
|
||||
},
|
||||
|
||||
// Optional: Self-hosted backend
|
||||
// contentApiUrlOverride: '/api/tina/gql',
|
||||
})
|
||||
Reference in New Issue
Block a user