feat: update website-creator to static mode with ConsentOS + tracking scripts

- Remove Astro DB (no longer needed for consent logging)
- Change from SSR to static output mode
- Add TrackingScripts.astro with GA4, GTM, Umami, Clarity, FB Pixel, Google Ads, TikTok, LINE
- Use ConsentOS consent-loader.js for auto-blocking tracking scripts
- Update Dockerfile to nginx static hosting
- Remove old consent template (custom consent no longer needed)
- Update SKILL.md, AGENTS.md, README.md documentation
- Add nginx.conf for static hosting
This commit is contained in:
2026-04-21 21:19:32 +07:00
parent d1edc9cd6c
commit c38cc4ae26
19 changed files with 378 additions and 1099 deletions

View File

@@ -6,8 +6,7 @@
#
# This script migrates websites to Astro + Tina CMS:
# - Converts content to Tina CMS format
# - Sets up Astro DB for consent logging
# - Adds PDPA-compliant consent system
# - Sets up external consent system integration
# - Preserves content and structure
#
# Requirements:
@@ -49,8 +48,7 @@ Examples:
Features:
- Detects source website technology (Astro, Next.js, etc.)
- Converts content to Tina CMS format
- Sets up Astro DB for consent logging (PDPA compliant)
- Adds cookie consent banner with Thai law compliance
- Sets up external consent system integration
- Preserves SEO metadata and content structure
EOF
@@ -160,22 +158,6 @@ migrate_content() {
log_success "Content migration complete"
}
add_consent_system() {
log_info "Adding PDPA-compliant consent system..."
local consent_template="$(dirname "$(dirname "$(readlink -f "$0")")")/templates/consent"
if [ ! -d "$consent_template" ]; then
log_warning "Consent template not found, skipping"
return
fi
# Copy consent files
cp -r "$consent_template"/* "$TARGET_PATH/src/components/consent/" 2>/dev/null || true
log_success "Consent system added"
}
create_tina_schema() {
log_info "Creating Tina CMS schema..."
@@ -302,25 +284,14 @@ Self-hosted Git-based CMS for visual content editing.
### ✅ Tailwind CSS 4.x
Latest Tailwind with @tailwindcss/vite plugin.
### ✅ Astro DB
Built-in database for consent logging and dynamic content.
### ✅ PDPA Consent System
Thai Personal Data Protection Act compliant cookie consent:
- Cookie banner with Accept/Reject/Preferences
- Consent logging in Astro DB
- API endpoint for consent management
### ✅ Nano Stores
Lightweight client-side state management.
### ✅ External Consent System
Integration with consent.moreminimore.com for PDPA compliance.
## Project Structure
\`\`\`
$TARGET_PATH/
├── src/
│ ├── components/
│ │ └── consent/ # PDPA consent system
│ ├── content/
│ │ ├── posts/ # Blog posts (Tina managed)
│ │ └── pages/ # Static pages (Tina managed)
@@ -332,8 +303,6 @@ $TARGET_PATH/
│ └── global.css
├── .tina/
│ └── schema.ts # Tina content schema
├── db/
│ └── config.ts # Astro DB config
├── Dockerfile
└── AGENTS.md # AI agent instructions
\`\`\`
@@ -377,16 +346,6 @@ This will install:
- Auth.js for authentication
- Database adapter for content storage
- Git provider for content management
## PDPA Compliance
The consent system logs:
- User consent choices (accept/reject)
- Cookie categories (analytics, marketing, functional)
- Timestamp and user agent
- IP address (for compliance auditing)
Logs are stored in Astro DB and can be exported for compliance reporting.
EOF
log_success "Migration report: $TARGET_PATH/MIGRATION_REPORT.md"
@@ -423,7 +382,6 @@ main() {
analyze_source_content
copy_template
migrate_content
add_consent_system
create_tina_schema
create_migration_report

View File

@@ -36,8 +36,7 @@ Creates:
- Astro 6.1.7 framework
- Tailwind CSS 4.x
- Tina CMS (self-hosted)
- Astro DB for consent logging
- PDPA-compliant consent system
- External consent system integration
EOF
}
@@ -105,26 +104,6 @@ copy_template() {
log_success "Template copied"
}
copy_consent_system() {
log_info "Adding PDPA consent system..."
local consent_template="$SKILL_DIR/templates/consent"
if [ -d "$consent_template" ]; then
mkdir -p "$PROJECT_PATH/src/components/consent"
cp "$consent_template/ConsentBanner.astro" "$PROJECT_PATH/src/components/consent/" 2>/dev/null || true
cp "$consent_template/stores/"* "$PROJECT_PATH/src/stores/" 2>/dev/null || true
mkdir -p "$PROJECT_PATH/src/pages/api"
cp "$consent_template/api/consent.ts" "$PROJECT_PATH/src/pages/api/" 2>/dev/null || true
mkdir -p "$PROJECT_PATH/db"
cp "$consent_template/db/config.ts" "$PROJECT_PATH/db/" 2>/dev/null || true
fi
log_success "Consent system added"
}
copy_legal_templates() {
log_info "Copying PDPA legal templates..."
@@ -163,6 +142,9 @@ setup_environment() {
cat > .env << 'EOF'
PUBLIC_SITE_URL=http://localhost:4321
TINA_TOKEN=your-tina-token
TINA_CLIENT_ID=your-client-id
PUBLIC_CONSENT_SITE_ID=your-consent-site-id
PUBLIC_CONSENT_API_BASE=https://consent.moreminimore.com
EOF
log_success "Created default .env"
fi
@@ -203,7 +185,6 @@ main() {
check_requirements
setup_directory
copy_template
copy_consent_system
copy_legal_templates
install_dependencies
setup_environment