Add GitHub Pages deployment and Decap CMS support
- Add GitHub Actions workflow for automatic deployment to GitHub Pages - Configure Decap CMS for Turkish blog post management - Add Netlify Identity integration for authentication - Create admin redirect page and routing - Add comprehensive setup documentation - Configure proper Turkish field labels and defaults - Enable image uploads and media management Site will now auto-deploy on every push to main branch. Access CMS at: https://ym1ktc.github.io/ARC-Web-Sitesi/admin/ 🤖 Generated with Claude Code
This commit is contained in:
@@ -0,0 +1,90 @@
|
|||||||
|
# Sample workflow for building and deploying an Astro site to GitHub Pages
|
||||||
|
#
|
||||||
|
# To get started with Astro see: https://docs.astro.build/en/getting-started/
|
||||||
|
#
|
||||||
|
name: Deploy Astro site to Pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Runs on pushes targeting the default branch
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
||||||
|
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
||||||
|
concurrency:
|
||||||
|
group: "pages"
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILD_PATH: "." # default value when not using subfolders
|
||||||
|
# BUILD_PATH: subfolder
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Detect package manager
|
||||||
|
id: detect-package-manager
|
||||||
|
run: |
|
||||||
|
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
|
||||||
|
echo "manager=yarn" >> $GITHUB_OUTPUT
|
||||||
|
echo "command=install" >> $GITHUB_OUTPUT
|
||||||
|
echo "runner=yarn" >> $GITHUB_OUTPUT
|
||||||
|
echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT
|
||||||
|
exit 0
|
||||||
|
elif [ -f "${{ github.workspace }}/package.json" ]; then
|
||||||
|
echo "manager=npm" >> $GITHUB_OUTPUT
|
||||||
|
echo "command=ci" >> $GITHUB_OUTPUT
|
||||||
|
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
|
||||||
|
echo "lockfile=package-lock.json" >> $GITHUB_OUTPUT
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Unable to determine package manager"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
cache: ${{ steps.detect-package-manager.outputs.manager }}
|
||||||
|
cache-dependency-path: ${{ env.BUILD_PATH }}/${{ steps.detect-package-manager.outputs.lockfile }}
|
||||||
|
- name: Setup Pages
|
||||||
|
id: pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
- name: Install dependencies
|
||||||
|
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
|
||||||
|
working-directory: ${{ env.BUILD_PATH }}
|
||||||
|
- name: Build with Astro
|
||||||
|
run: |
|
||||||
|
${{ steps.detect-package-manager.outputs.runner }} astro build \
|
||||||
|
--site "${{ steps.pages.outputs.origin }}" \
|
||||||
|
--base "${{ steps.pages.outputs.base_path }}"
|
||||||
|
working-directory: ${{ env.BUILD_PATH }}
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
with:
|
||||||
|
path: ${{ env.BUILD_PATH }}/dist
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Deploy
|
||||||
|
steps:
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
# Decap CMS Setup for ARC Website
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
## Setup Instructions
|
||||||
|
|
||||||
|
### 1. Enable Netlify Identity
|
||||||
|
1. Go to your Netlify dashboard
|
||||||
|
2. Navigate to your site settings
|
||||||
|
3. Go to "Identity" tab
|
||||||
|
4. Click "Enable Identity"
|
||||||
|
5. In Identity settings, configure:
|
||||||
|
- Registration: "Invite only" (recommended)
|
||||||
|
- External providers: Enable GitHub, Google, etc. as needed
|
||||||
|
- Git Gateway: Enable this service
|
||||||
|
|
||||||
|
### 2. Configure Git Gateway
|
||||||
|
1. In your site's Identity settings
|
||||||
|
2. Go to "Services" tab
|
||||||
|
3. Enable "Git Gateway"
|
||||||
|
4. This allows Decap CMS to commit directly to your GitHub repository
|
||||||
|
|
||||||
|
### 3. Invite Users
|
||||||
|
1. In Identity tab, click "Invite users"
|
||||||
|
2. Enter email addresses of content editors
|
||||||
|
3. They will receive invitation emails
|
||||||
|
|
||||||
|
### 4. Access the CMS
|
||||||
|
- CMS URL: `https://your-site.netlify.app/admin/`
|
||||||
|
- Users can log in with their invited credentials
|
||||||
|
- The CMS will redirect to `/decapcms/` for the actual interface
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
### Turkish Interface
|
||||||
|
- All field labels are in Turkish
|
||||||
|
- Configured for Turkish content creators
|
||||||
|
- Default author set to "TA1SPH"
|
||||||
|
|
||||||
|
### Blog Post Management
|
||||||
|
- Create new blog posts
|
||||||
|
- Edit existing posts
|
||||||
|
- Upload featured images
|
||||||
|
- Organize with categories and tags
|
||||||
|
- Markdown editor for content
|
||||||
|
|
||||||
|
### File Structure
|
||||||
|
- Blog posts are stored in `src/data/post/`
|
||||||
|
- Images are stored in `src/assets/images/`
|
||||||
|
- Posts use the format: `YYYY-MM-DD-slug.md`
|
||||||
|
|
||||||
|
## Configuration Files
|
||||||
|
|
||||||
|
### `/public/decapcms/config.yml`
|
||||||
|
Main configuration file that defines:
|
||||||
|
- Backend (Git Gateway)
|
||||||
|
- Collections (Blog posts)
|
||||||
|
- Fields and their types
|
||||||
|
- Media handling
|
||||||
|
|
||||||
|
### `/public/decapcms/index.html`
|
||||||
|
The CMS interface HTML file
|
||||||
|
|
||||||
|
### `/public/_redirects`
|
||||||
|
Netlify redirect rules for admin routing
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
1. Users navigate to `/admin/`
|
||||||
|
2. They are redirected to the CMS interface
|
||||||
|
3. After authentication, they can:
|
||||||
|
- Create new blog posts
|
||||||
|
- Edit existing posts
|
||||||
|
- Upload images
|
||||||
|
- Manage categories and tags
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
- Only invited users can access the CMS
|
||||||
|
- All changes are committed to the main repository
|
||||||
|
- GitHub Actions will automatically deploy changes
|
||||||
|
- Content is version-controlled through Git
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Common Issues:
|
||||||
|
1. **Can't log in**: Check if Identity is enabled and user is invited
|
||||||
|
2. **Can't save posts**: Ensure Git Gateway is enabled
|
||||||
|
3. **Images not uploading**: Check media folder permissions
|
||||||
|
4. **Changes not deploying**: Verify GitHub Actions workflow
|
||||||
|
|
||||||
|
### Support
|
||||||
|
For technical issues, contact the development team or check the Decap CMS documentation at https://decapcms.org/docs/
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/admin/* /decapcms/index.html 200
|
||||||
+14
-18
@@ -5,25 +5,21 @@ backend:
|
|||||||
media_folder: 'src/assets/images'
|
media_folder: 'src/assets/images'
|
||||||
public_folder: '/_astro'
|
public_folder: '/_astro'
|
||||||
|
|
||||||
|
site_url: https://ym1ktc.github.io/ARC-Web-Sitesi
|
||||||
|
display_url: https://ym1ktc.github.io/ARC-Web-Sitesi
|
||||||
|
|
||||||
collections:
|
collections:
|
||||||
- name: 'post'
|
- name: 'post'
|
||||||
label: 'Post'
|
label: 'Blog Yazıları'
|
||||||
folder: 'src/content/post'
|
folder: 'src/data/post'
|
||||||
create: true
|
create: true
|
||||||
|
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
|
||||||
fields:
|
fields:
|
||||||
- { label: 'Title', name: 'title', widget: 'string' }
|
- { label: 'Başlık', name: 'title', widget: 'string' }
|
||||||
- { label: 'Excerpt', name: 'excerpt', widget: 'string' }
|
- { label: 'Yayın Tarihi', name: 'date', widget: 'datetime', format: 'YYYY-MM-DD HH:mm:ss' }
|
||||||
- { label: 'Category', name: 'category', widget: 'string' }
|
- { 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: 'Tags',
|
- { label: 'Etiketler', name: 'tags', widget: 'list', allow_add: true, allow_delete: true, collapsed: false, field: { label: 'Etiket', name: 'tag', widget: 'string' } }
|
||||||
name: 'tags',
|
- { label: 'Düzen', name: 'layout', widget: 'string', default: 'post' }
|
||||||
widget: 'list',
|
- { label: 'Öne Çıkan Görsel', name: 'image', widget: 'image', media_folder: '/src/assets/images', public_folder: '~/assets/images', required: false }
|
||||||
allow_add: true,
|
- { label: 'İçerik', name: 'body', widget: 'markdown' }
|
||||||
allow_delete: true,
|
|
||||||
collapsed: false,
|
|
||||||
field: { label: 'Tag', name: 'tag', widget: 'string' },
|
|
||||||
}
|
|
||||||
- { label: 'Image', name: 'image', widget: 'string' }
|
|
||||||
- { label: 'Publish Date', name: 'publishDate', widget: 'datetime', required: false }
|
|
||||||
- { label: 'Author', name: 'author', widget: 'string' }
|
|
||||||
- { label: 'Content', name: 'body', widget: 'markdown' }
|
|
||||||
|
|||||||
@@ -4,11 +4,23 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
<title>Content Manager</title>
|
<title>ARC İçerik Yöneticisi</title>
|
||||||
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
|
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- Include the script that builds the page and powers Decap CMS -->
|
<!-- Include the script that builds the page and powers Decap CMS -->
|
||||||
<script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
|
<script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script>
|
||||||
|
<script>
|
||||||
|
// Initialize Netlify Identity widget
|
||||||
|
if (window.netlifyIdentity) {
|
||||||
|
window.netlifyIdentity.on("init", user => {
|
||||||
|
if (!user) {
|
||||||
|
window.netlifyIdentity.on("login", () => {
|
||||||
|
document.location.href = "/admin/";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ const { language, textDirection } = I18N;
|
|||||||
<Metadata {...metadata} />
|
<Metadata {...metadata} />
|
||||||
<SiteVerification />
|
<SiteVerification />
|
||||||
<Analytics />
|
<Analytics />
|
||||||
|
|
||||||
|
<!-- Netlify Identity for Decap CMS -->
|
||||||
|
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
|
||||||
|
|
||||||
<!-- Comment the line below to disable View Transitions -->
|
<!-- Comment the line below to disable View Transitions -->
|
||||||
<ClientRouter fallback="swap" />
|
<ClientRouter fallback="swap" />
|
||||||
@@ -44,5 +47,18 @@ const { language, textDirection } = I18N;
|
|||||||
<slot />
|
<slot />
|
||||||
|
|
||||||
<BasicScripts />
|
<BasicScripts />
|
||||||
|
|
||||||
|
<!-- Netlify Identity initialization -->
|
||||||
|
<script>
|
||||||
|
if (window.netlifyIdentity) {
|
||||||
|
window.netlifyIdentity.on("init", user => {
|
||||||
|
if (!user) {
|
||||||
|
window.netlifyIdentity.on("login", () => {
|
||||||
|
document.location.href = "/admin/";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
// Redirect to decap CMS
|
||||||
|
---
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="0; url=/decapcms/" />
|
||||||
|
<script>
|
||||||
|
window.location.replace('/decapcms/');
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Redirecting to CMS...</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user