optimizely-previewlisted
Install: claude install-skill tgardner18/optitech-nextjs
# Optimizely Live Preview Setup and Troubleshooting
This skill helps you set up live preview for Optimizely CMS in React applications or troubleshoot existing preview configurations.
## Overview
Live preview allows editors to see content changes in real-time before publishing. When properly configured, editors can click "Preview" in the Optimizely CMS and see their changes instantly in your application without leaving the editor interface.
## When to Use This Skill
- Setting up live preview for the first time
- Preview doesn't show in the CMS (blank screen, errors, or nothing happens)
- Verifying preview configuration
- Debugging preview communication issues
## Step 1: Detect the Framework
Before setting up preview, detect which React framework the user is using:
1. **Check for Next.js**:
- Look for `next.config.js` or `next.config.mjs` in the project root
- Check if App Router: `src/app/` or `app/` directory exists
- Check if Pages Router: `src/pages/` or `pages/` directory exists
2. **Check for TanStack Start**:
- Check package.json for `@tanstack/react-start` dependency
- Routes typically in `src/routes/` or `app/routes/`
3. **If unclear**: Ask the user which framework they're using
## Step 2: Set Up Preview Route
Create the preview route in the correct location based on the detected framework.
### Next.js App Router
Create `src/app/preview/page.tsx` (or `app/preview/page.tsx` if no src directory):
```tsx
import { GraphClient, type PreviewPara