Fix TypeScript errors for Netlify Identity integration
- Add proper TypeScript types for Netlify Identity in env.d.ts - Define NetlifyUser and NetlifyIdentity interfaces - Fix ESLint errors by removing 'any' types - Add optional chaining for safe access - Apply code formatting with Prettier All TypeScript, ESLint, and Prettier checks now pass successfully. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+15
-1
@@ -1,11 +1,13 @@
|
|||||||
# Decap CMS Setup for ARC Website
|
# Decap CMS Setup for ARC Website
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
This website uses Decap CMS (formerly Netlify CMS) for content management. It allows authorized users to create, edit, and manage blog posts through a web interface.
|
This website uses Decap CMS (formerly Netlify CMS) for content management. It allows authorized users to create, edit, and manage blog posts through a web interface.
|
||||||
|
|
||||||
## Setup Instructions
|
## Setup Instructions
|
||||||
|
|
||||||
### 1. Enable Netlify Identity
|
### 1. Enable Netlify Identity
|
||||||
|
|
||||||
1. Go to your Netlify dashboard
|
1. Go to your Netlify dashboard
|
||||||
2. Navigate to your site settings
|
2. Navigate to your site settings
|
||||||
3. Go to "Identity" tab
|
3. Go to "Identity" tab
|
||||||
@@ -16,17 +18,20 @@ This website uses Decap CMS (formerly Netlify CMS) for content management. It al
|
|||||||
- Git Gateway: Enable this service
|
- Git Gateway: Enable this service
|
||||||
|
|
||||||
### 2. Configure Git Gateway
|
### 2. Configure Git Gateway
|
||||||
|
|
||||||
1. In your site's Identity settings
|
1. In your site's Identity settings
|
||||||
2. Go to "Services" tab
|
2. Go to "Services" tab
|
||||||
3. Enable "Git Gateway"
|
3. Enable "Git Gateway"
|
||||||
4. This allows Decap CMS to commit directly to your GitHub repository
|
4. This allows Decap CMS to commit directly to your GitHub repository
|
||||||
|
|
||||||
### 3. Invite Users
|
### 3. Invite Users
|
||||||
|
|
||||||
1. In Identity tab, click "Invite users"
|
1. In Identity tab, click "Invite users"
|
||||||
2. Enter email addresses of content editors
|
2. Enter email addresses of content editors
|
||||||
3. They will receive invitation emails
|
3. They will receive invitation emails
|
||||||
|
|
||||||
### 4. Access the CMS
|
### 4. Access the CMS
|
||||||
|
|
||||||
- CMS URL: `https://your-site.netlify.app/admin/`
|
- CMS URL: `https://your-site.netlify.app/admin/`
|
||||||
- Users can log in with their invited credentials
|
- Users can log in with their invited credentials
|
||||||
- The CMS will redirect to `/decapcms/` for the actual interface
|
- The CMS will redirect to `/decapcms/` for the actual interface
|
||||||
@@ -34,11 +39,13 @@ This website uses Decap CMS (formerly Netlify CMS) for content management. It al
|
|||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Turkish Interface
|
### Turkish Interface
|
||||||
|
|
||||||
- All field labels are in Turkish
|
- All field labels are in Turkish
|
||||||
- Configured for Turkish content creators
|
- Configured for Turkish content creators
|
||||||
- Default author set to "TA1SPH"
|
- Default author set to "TA1SPH"
|
||||||
|
|
||||||
### Blog Post Management
|
### Blog Post Management
|
||||||
|
|
||||||
- Create new blog posts
|
- Create new blog posts
|
||||||
- Edit existing posts
|
- Edit existing posts
|
||||||
- Upload featured images
|
- Upload featured images
|
||||||
@@ -46,6 +53,7 @@ This website uses Decap CMS (formerly Netlify CMS) for content management. It al
|
|||||||
- Markdown editor for content
|
- Markdown editor for content
|
||||||
|
|
||||||
### File Structure
|
### File Structure
|
||||||
|
|
||||||
- Blog posts are stored in `src/data/post/`
|
- Blog posts are stored in `src/data/post/`
|
||||||
- Images are stored in `src/assets/images/`
|
- Images are stored in `src/assets/images/`
|
||||||
- Posts use the format: `YYYY-MM-DD-slug.md`
|
- Posts use the format: `YYYY-MM-DD-slug.md`
|
||||||
@@ -53,16 +61,20 @@ This website uses Decap CMS (formerly Netlify CMS) for content management. It al
|
|||||||
## Configuration Files
|
## Configuration Files
|
||||||
|
|
||||||
### `/public/decapcms/config.yml`
|
### `/public/decapcms/config.yml`
|
||||||
|
|
||||||
Main configuration file that defines:
|
Main configuration file that defines:
|
||||||
|
|
||||||
- Backend (Git Gateway)
|
- Backend (Git Gateway)
|
||||||
- Collections (Blog posts)
|
- Collections (Blog posts)
|
||||||
- Fields and their types
|
- Fields and their types
|
||||||
- Media handling
|
- Media handling
|
||||||
|
|
||||||
### `/public/decapcms/index.html`
|
### `/public/decapcms/index.html`
|
||||||
|
|
||||||
The CMS interface HTML file
|
The CMS interface HTML file
|
||||||
|
|
||||||
### `/public/_redirects`
|
### `/public/_redirects`
|
||||||
|
|
||||||
Netlify redirect rules for admin routing
|
Netlify redirect rules for admin routing
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -85,10 +97,12 @@ Netlify redirect rules for admin routing
|
|||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### Common Issues:
|
### Common Issues:
|
||||||
|
|
||||||
1. **Can't log in**: Check if Identity is enabled and user is invited
|
1. **Can't log in**: Check if Identity is enabled and user is invited
|
||||||
2. **Can't save posts**: Ensure Git Gateway is enabled
|
2. **Can't save posts**: Ensure Git Gateway is enabled
|
||||||
3. **Images not uploading**: Check media folder permissions
|
3. **Images not uploading**: Check media folder permissions
|
||||||
4. **Changes not deploying**: Verify GitHub Actions workflow
|
4. **Changes not deploying**: Verify GitHub Actions workflow
|
||||||
|
|
||||||
### Support
|
### Support
|
||||||
For technical issues, contact the development team or check the Decap CMS documentation at https://decapcms.org/docs/
|
|
||||||
|
For technical issues, contact the development team or check the Decap CMS documentation at https://decapcms.org/docs/
|
||||||
|
|||||||
@@ -18,8 +18,31 @@ collections:
|
|||||||
- { label: 'Başlık', name: 'title', widget: 'string' }
|
- { label: 'Başlık', name: 'title', widget: 'string' }
|
||||||
- { label: 'Yayın Tarihi', name: 'date', widget: 'datetime', format: 'YYYY-MM-DD HH:mm:ss' }
|
- { label: 'Yayın Tarihi', name: 'date', widget: 'datetime', format: 'YYYY-MM-DD HH:mm:ss' }
|
||||||
- { label: 'Yazar', name: 'author', widget: 'string', default: 'TA1SPH' }
|
- { label: 'Yazar', name: 'author', widget: 'string', default: 'TA1SPH' }
|
||||||
- { label: 'Kategoriler', name: 'categories', widget: 'list', allow_add: true, allow_delete: true, collapsed: false, field: { label: 'Kategori', name: 'category', widget: 'string' } }
|
- {
|
||||||
- { label: 'Etiketler', name: 'tags', widget: 'list', allow_add: true, allow_delete: true, collapsed: false, field: { label: 'Etiket', name: 'tag', widget: 'string' } }
|
label: 'Kategoriler',
|
||||||
|
name: 'categories',
|
||||||
|
widget: 'list',
|
||||||
|
allow_add: true,
|
||||||
|
allow_delete: true,
|
||||||
|
collapsed: false,
|
||||||
|
field: { label: 'Kategori', name: 'category', widget: 'string' },
|
||||||
|
}
|
||||||
|
- {
|
||||||
|
label: 'Etiketler',
|
||||||
|
name: 'tags',
|
||||||
|
widget: 'list',
|
||||||
|
allow_add: true,
|
||||||
|
allow_delete: true,
|
||||||
|
collapsed: false,
|
||||||
|
field: { label: 'Etiket', name: 'tag', widget: 'string' },
|
||||||
|
}
|
||||||
- { label: 'Düzen', name: 'layout', widget: 'string', default: 'post' }
|
- { label: 'Düzen', name: 'layout', widget: 'string', default: 'post' }
|
||||||
- { label: 'Öne Çıkan Görsel', name: 'image', widget: 'image', media_folder: '/src/assets/images', public_folder: '~/assets/images', required: false }
|
- {
|
||||||
|
label: 'Öne Çıkan Görsel',
|
||||||
|
name: 'image',
|
||||||
|
widget: 'image',
|
||||||
|
media_folder: '/src/assets/images',
|
||||||
|
public_folder: '~/assets/images',
|
||||||
|
required: false,
|
||||||
|
}
|
||||||
- { label: 'İçerik', name: 'body', widget: 'markdown' }
|
- { label: 'İçerik', name: 'body', widget: 'markdown' }
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
<script>
|
<script>
|
||||||
// Initialize Netlify Identity widget
|
// Initialize Netlify Identity widget
|
||||||
if (window.netlifyIdentity) {
|
if (window.netlifyIdentity) {
|
||||||
window.netlifyIdentity.on("init", user => {
|
window.netlifyIdentity.on('init', (user) => {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
window.netlifyIdentity.on("login", () => {
|
window.netlifyIdentity.on('login', () => {
|
||||||
document.location.href = "/admin/";
|
document.location.href = '/admin/';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Vendored
+25
@@ -3,3 +3,28 @@
|
|||||||
/// <reference types="astro/client" />
|
/// <reference types="astro/client" />
|
||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
/// <reference types="../vendor/integration/types.d.ts" />
|
/// <reference types="../vendor/integration/types.d.ts" />
|
||||||
|
|
||||||
|
// Netlify Identity types
|
||||||
|
interface NetlifyUser {
|
||||||
|
id: string;
|
||||||
|
email: string;
|
||||||
|
user_metadata: Record<string, unknown>;
|
||||||
|
app_metadata: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NetlifyIdentity {
|
||||||
|
on: (event: string, callback: (user?: NetlifyUser) => void) => void;
|
||||||
|
init: () => void;
|
||||||
|
open: () => void;
|
||||||
|
close: () => void;
|
||||||
|
currentUser: () => NetlifyUser | null;
|
||||||
|
logout: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
netlifyIdentity?: NetlifyIdentity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const { language, textDirection } = I18N;
|
|||||||
<Metadata {...metadata} />
|
<Metadata {...metadata} />
|
||||||
<SiteVerification />
|
<SiteVerification />
|
||||||
<Analytics />
|
<Analytics />
|
||||||
|
|
||||||
<!-- Netlify Identity for Decap CMS -->
|
<!-- Netlify Identity for Decap CMS -->
|
||||||
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
|
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
|
||||||
|
|
||||||
@@ -47,14 +47,14 @@ const { language, textDirection } = I18N;
|
|||||||
<slot />
|
<slot />
|
||||||
|
|
||||||
<BasicScripts />
|
<BasicScripts />
|
||||||
|
|
||||||
<!-- Netlify Identity initialization -->
|
<!-- Netlify Identity initialization -->
|
||||||
<script>
|
<script>
|
||||||
if (window.netlifyIdentity) {
|
if (window.netlifyIdentity) {
|
||||||
window.netlifyIdentity.on("init", user => {
|
window.netlifyIdentity.on('init', (user) => {
|
||||||
if (!user) {
|
if (!user) {
|
||||||
window.netlifyIdentity.on("login", () => {
|
window.netlifyIdentity?.on('login', () => {
|
||||||
document.location.href = "/admin/";
|
document.location.href = '/admin/';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,4 +12,4 @@
|
|||||||
<body>
|
<body>
|
||||||
<p>Redirecting to CMS...</p>
|
<p>Redirecting to CMS...</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user