Research component integration, Copilotkit implementation, SEO copilotkit implementation, Wix SEO metadata complete, Wix SEO metadata review
This commit is contained in:
335
docs/RESEARCH_COMPONENT_INTEGRATION.md
Normal file
335
docs/RESEARCH_COMPONENT_INTEGRATION.md
Normal file
@@ -0,0 +1,335 @@
|
||||
# Research Component Integration Guide
|
||||
|
||||
## Overview
|
||||
|
||||
The modular Research component has been implemented as a standalone, testable wizard that can be integrated into the blog writer or used independently. This document outlines the architecture, usage, and integration steps.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Backend Strategy Pattern
|
||||
|
||||
The research service now supports multiple research modes through a strategy pattern:
|
||||
|
||||
```python
|
||||
# Research modes
|
||||
- Basic: Quick keyword-focused analysis
|
||||
- Comprehensive: Full analysis with all components
|
||||
- Targeted: Customizable components based on config
|
||||
|
||||
# Strategy implementation
|
||||
backend/services/blog_writer/research/research_strategies.py
|
||||
- ResearchStrategy (base class)
|
||||
- BasicResearchStrategy
|
||||
- ComprehensiveResearchStrategy
|
||||
- TargetedResearchStrategy
|
||||
```
|
||||
|
||||
### Frontend Component Structure
|
||||
|
||||
```
|
||||
frontend/src/components/Research/
|
||||
├── index.tsx # Main exports
|
||||
├── ResearchWizard.tsx # Main wizard container
|
||||
├── steps/
|
||||
│ ├── StepKeyword.tsx # Step 1: Keyword input
|
||||
│ ├── StepOptions.tsx # Step 2: Mode selection
|
||||
│ ├── StepProgress.tsx # Step 3: Progress display
|
||||
│ └── StepResults.tsx # Step 4: Results display
|
||||
├── hooks/
|
||||
│ ├── useResearchWizard.ts # Wizard state management
|
||||
│ └── useResearchExecution.ts # API calls and polling
|
||||
├── types/
|
||||
│ └── research.types.ts # TypeScript interfaces
|
||||
└── utils/
|
||||
└── researchUtils.ts # Utility functions
|
||||
```
|
||||
|
||||
## Test Page
|
||||
|
||||
A dedicated test page is available at `/research-test` for testing the research wizard independently.
|
||||
|
||||
**Features:**
|
||||
- Quick preset keywords for testing
|
||||
- Debug panel with JSON export
|
||||
- Performance metrics display
|
||||
- Cache state visualization
|
||||
|
||||
## Usage
|
||||
|
||||
### Standalone Usage
|
||||
|
||||
```typescript
|
||||
import { ResearchWizard } from '../components/Research';
|
||||
|
||||
<ResearchWizard
|
||||
onComplete={(results) => {
|
||||
console.log('Research complete:', results);
|
||||
}}
|
||||
onCancel={() => {
|
||||
console.log('Cancelled');
|
||||
}}
|
||||
initialKeywords={['AI', 'marketing']}
|
||||
initialIndustry="Technology"
|
||||
/>
|
||||
```
|
||||
|
||||
### Integration with Blog Writer
|
||||
|
||||
The component is designed to be easily integrated into the BlogWriter research phase:
|
||||
|
||||
**Current Implementation:**
|
||||
- Uses CopilotKit sidebar for research input
|
||||
- Displays results in `ResearchResults` component
|
||||
- Manual fallback via `ManualResearchForm`
|
||||
|
||||
**Proposed Integration:**
|
||||
Replace the CopilotKit/manual form with the wizard:
|
||||
|
||||
```typescript
|
||||
// In BlogWriter.tsx
|
||||
{currentPhase === 'research' && (
|
||||
<ResearchWizard
|
||||
onComplete={(results) => setResearch(results)}
|
||||
onCancel={() => navigate('blog-writer')}
|
||||
/>
|
||||
)}
|
||||
```
|
||||
|
||||
## Backend API Changes
|
||||
|
||||
### New Models
|
||||
|
||||
The `BlogResearchRequest` model now supports:
|
||||
|
||||
```python
|
||||
class BlogResearchRequest(BaseModel):
|
||||
keywords: List[str]
|
||||
topic: Optional[str] = None
|
||||
industry: Optional[str] = None
|
||||
target_audience: Optional[str] = None
|
||||
tone: Optional[str] = None
|
||||
word_count_target: Optional[int] = 1500
|
||||
persona: Optional[PersonaInfo] = None
|
||||
research_mode: Optional[ResearchMode] = ResearchMode.BASIC # NEW
|
||||
config: Optional[ResearchConfig] = None # NEW
|
||||
```
|
||||
|
||||
### Backward Compatibility
|
||||
|
||||
The API remains backward compatible:
|
||||
- If `research_mode` is not provided, defaults to `BASIC`
|
||||
- If `config` is not provided, defaults to standard configuration
|
||||
- Existing requests continue to work unchanged
|
||||
|
||||
## Research Modes
|
||||
|
||||
### Basic Mode
|
||||
- Quick keyword analysis
|
||||
- Primary & secondary keywords
|
||||
- Current trends overview
|
||||
- Top 5 content angles
|
||||
- Key statistics
|
||||
|
||||
### Comprehensive Mode
|
||||
- All basic features plus:
|
||||
- Expert quotes & opinions
|
||||
- Competitor analysis
|
||||
- Market forecasts
|
||||
- Best practices & case studies
|
||||
- Content gaps identification
|
||||
|
||||
### Targeted Mode
|
||||
- Selectable components:
|
||||
- Statistics
|
||||
- Expert quotes
|
||||
- Competitors
|
||||
- Trends
|
||||
- Always includes: Keywords & content angles
|
||||
|
||||
## Configuration Options
|
||||
|
||||
### ResearchConfig Model
|
||||
|
||||
```python
|
||||
class ResearchConfig(BaseModel):
|
||||
mode: ResearchMode = ResearchMode.BASIC
|
||||
date_range: Optional[DateRange] = None
|
||||
source_types: List[SourceType] = []
|
||||
max_sources: int = 10
|
||||
include_statistics: bool = True
|
||||
include_expert_quotes: bool = True
|
||||
include_competitors: bool = True
|
||||
include_trends: bool = True
|
||||
```
|
||||
|
||||
### Date Range Options
|
||||
- `last_week`
|
||||
- `last_month`
|
||||
- `last_3_months`
|
||||
- `last_6_months`
|
||||
- `last_year`
|
||||
- `all_time`
|
||||
|
||||
### Source Types
|
||||
- `web` - Web articles
|
||||
- `academic` - Academic papers
|
||||
- `news` - News articles
|
||||
- `industry` - Industry reports
|
||||
- `expert` - Expert opinions
|
||||
|
||||
## Caching
|
||||
|
||||
The research component uses the existing cache infrastructure:
|
||||
- Cache keys include research mode
|
||||
- Cache is shared across basic/comprehensive/targeted modes
|
||||
- Cache invalidation handled automatically
|
||||
|
||||
## Testing
|
||||
|
||||
### Test the Wizard
|
||||
|
||||
1. Navigate to `/research-test`
|
||||
2. Use quick presets or enter custom keywords
|
||||
3. Select research mode
|
||||
4. Monitor progress
|
||||
5. Review results
|
||||
6. Export JSON for analysis
|
||||
|
||||
### Integration Testing
|
||||
|
||||
To test integration with BlogWriter:
|
||||
|
||||
1. Start backend: `python start_alwrity_backend.py`
|
||||
2. Navigate to `/blog-writer` (current implementation)
|
||||
3. Or navigate to `/research-test` (new wizard)
|
||||
4. Compare results and UI
|
||||
|
||||
## Migration Path
|
||||
|
||||
### Phase 1: Parallel Testing (Current)
|
||||
- `/research-test` - New wizard available
|
||||
- `/blog-writer` - Current implementation unchanged
|
||||
- Users can test both
|
||||
|
||||
### Phase 2: Integration
|
||||
1. Add wizard as option in BlogWriter
|
||||
2. A/B test user preference
|
||||
3. Monitor performance metrics
|
||||
|
||||
### Phase 3: Replacement (Optional)
|
||||
1. Replace CopilotKit/manual form with wizard
|
||||
2. Remove old implementation
|
||||
3. Update documentation
|
||||
|
||||
## API Endpoints
|
||||
|
||||
All existing endpoints remain unchanged:
|
||||
|
||||
```
|
||||
POST /api/blog/research/start
|
||||
- Supports new research_mode and config parameters
|
||||
- Backward compatible with existing requests
|
||||
|
||||
GET /api/blog/research/status/{task_id}
|
||||
- No changes required
|
||||
```
|
||||
|
||||
## Benefits
|
||||
|
||||
1. **Modularity**: Component works standalone
|
||||
2. **Testability**: Dedicated test page for experimentation
|
||||
3. **Backward Compatibility**: Existing functionality unchanged
|
||||
4. **Progressive Enhancement**: Can add features incrementally
|
||||
5. **Reusability**: Can be used in other parts of the app
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
Potential future improvements:
|
||||
|
||||
1. **Multi-stage Research**: Sequential research with refinement
|
||||
2. **Source Quality Validation**: Advanced credibility scoring
|
||||
3. **Interactive Query Builder**: Dynamic search refinement
|
||||
4. **Advanced Prompting**: Few-shot examples, reasoning chains
|
||||
5. **Custom Strategy Plugins**: User-defined research strategies
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Research Results Not Showing
|
||||
|
||||
Check:
|
||||
1. Backend logs for API errors
|
||||
2. Network tab for failed requests
|
||||
3. Browser console for JavaScript errors
|
||||
4. Verify user authentication
|
||||
|
||||
### Cache Issues
|
||||
|
||||
Clear cache:
|
||||
```typescript
|
||||
import { researchCache } from '../services/researchCache';
|
||||
researchCache.clearCache();
|
||||
```
|
||||
|
||||
### Type Errors
|
||||
|
||||
Ensure all imports are correct:
|
||||
```typescript
|
||||
import {
|
||||
ResearchWizard,
|
||||
useResearchWizard,
|
||||
WizardState
|
||||
} from '../components/Research';
|
||||
|
||||
import {
|
||||
BlogResearchRequest,
|
||||
BlogResearchResponse,
|
||||
ResearchMode,
|
||||
ResearchConfig
|
||||
} from '../services/blogWriterApi';
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Basic Integration
|
||||
|
||||
```typescript
|
||||
import { ResearchWizard } from './components/Research';
|
||||
import { BlogResearchResponse } from './services/blogWriterApi';
|
||||
|
||||
const MyComponent: React.FC = () => {
|
||||
const [results, setResults] = useState<BlogResearchResponse | null>(null);
|
||||
|
||||
return (
|
||||
<ResearchWizard
|
||||
onComplete={(res) => setResults(res)}
|
||||
onCancel={() => console.log('Cancelled')}
|
||||
/>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### Advanced Integration with Custom Config
|
||||
|
||||
```typescript
|
||||
const request: BlogResearchRequest = {
|
||||
keywords: ['AI', 'automation'],
|
||||
industry: 'Technology',
|
||||
research_mode: 'targeted',
|
||||
config: {
|
||||
mode: 'targeted',
|
||||
include_statistics: true,
|
||||
include_competitors: true,
|
||||
include_trends: false,
|
||||
max_sources: 20,
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
For issues or questions:
|
||||
1. Check this documentation
|
||||
2. Review test page examples
|
||||
3. Inspect backend logs
|
||||
4. Check frontend console
|
||||
|
||||
346
docs/RESEARCH_WIZARD_IMPLEMENTATION.md
Normal file
346
docs/RESEARCH_WIZARD_IMPLEMENTATION.md
Normal file
@@ -0,0 +1,346 @@
|
||||
# Research Wizard Implementation Summary
|
||||
|
||||
## Implementation Complete
|
||||
|
||||
A modular, pluggable research component has been successfully implemented with wizard-based UI that can be tested independently and integrated into the blog writer.
|
||||
|
||||
---
|
||||
|
||||
## Backend Implementation
|
||||
|
||||
### 1. Research Models (blog_models.py)
|
||||
|
||||
**New Enums:**
|
||||
- `ResearchMode`: `BASIC`, `COMPREHENSIVE`, `TARGETED`
|
||||
- `SourceType`: `WEB`, `ACADEMIC`, `NEWS`, `INDUSTRY`, `EXPERT`
|
||||
- `DateRange`: `LAST_WEEK` through `ALL_TIME`
|
||||
|
||||
**New Models:**
|
||||
```python
|
||||
class ResearchConfig(BaseModel):
|
||||
mode: ResearchMode = ResearchMode.BASIC
|
||||
date_range: Optional[DateRange] = None
|
||||
source_types: List[SourceType] = []
|
||||
max_sources: int = 10
|
||||
include_statistics: bool = True
|
||||
include_expert_quotes: bool = True
|
||||
include_competitors: bool = True
|
||||
include_trends: bool = True
|
||||
```
|
||||
|
||||
**Enhanced BlogResearchRequest:**
|
||||
- Added `research_mode: Optional[ResearchMode]`
|
||||
- Added `config: Optional[ResearchConfig]`
|
||||
- **Backward compatible** - defaults to existing behavior
|
||||
|
||||
### 2. Strategy Pattern (research_strategies.py)
|
||||
|
||||
**New file:** `backend/services/blog_writer/research/research_strategies.py`
|
||||
|
||||
**Three Strategy Classes:**
|
||||
1. **BasicResearchStrategy**: Quick keyword-focused analysis
|
||||
2. **ComprehensiveResearchStrategy**: Full analysis with all components
|
||||
3. **TargetedResearchStrategy**: Customizable components based on config
|
||||
|
||||
**Factory Function:**
|
||||
```python
|
||||
get_strategy_for_mode(mode: ResearchMode) -> ResearchStrategy
|
||||
```
|
||||
|
||||
### 3. Service Integration (research_service.py)
|
||||
|
||||
**Key Changes:**
|
||||
- Imports strategy factory and models
|
||||
- Uses strategy pattern in both `research()` and `research_with_progress()` methods
|
||||
- Automatically selects strategy based on `research_mode`
|
||||
- Backward compatible - defaults to BASIC if not specified
|
||||
|
||||
**Line Changes:**
|
||||
```python
|
||||
# Lines 88-96: Determine research mode and get appropriate strategy
|
||||
research_mode = request.research_mode or ResearchMode.BASIC
|
||||
config = request.config or ResearchConfig(mode=research_mode)
|
||||
strategy = get_strategy_for_mode(research_mode)
|
||||
|
||||
logger.info(f"Using research mode: {research_mode.value}")
|
||||
|
||||
# Build research prompt based on strategy
|
||||
research_prompt = strategy.build_research_prompt(topic, industry, target_audience, config)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Frontend Implementation
|
||||
|
||||
### 4. Component Structure
|
||||
|
||||
**New Directory:** `frontend/src/components/Research/`
|
||||
|
||||
```
|
||||
Research/
|
||||
├── index.tsx # Main exports
|
||||
├── ResearchWizard.tsx # Main wizard container
|
||||
├── steps/
|
||||
│ ├── StepKeyword.tsx # Step 1: Keyword input
|
||||
│ ├── StepOptions.tsx # Step 2: Mode selection (3 cards)
|
||||
│ ├── StepProgress.tsx # Step 3: Progress display
|
||||
│ └── StepResults.tsx # Step 4: Results display
|
||||
├── hooks/
|
||||
│ ├── useResearchWizard.ts # Wizard state management
|
||||
│ └── useResearchExecution.ts # API calls and polling
|
||||
├── types/
|
||||
│ └── research.types.ts # TypeScript interfaces
|
||||
├── utils/
|
||||
│ └── researchUtils.ts # Utility functions
|
||||
└── integrations/
|
||||
└── BlogWriterAdapter.tsx # Blog writer integration adapter
|
||||
```
|
||||
|
||||
### 5. Wizard Components
|
||||
|
||||
**ResearchWizard.tsx:**
|
||||
- Main container with progress bar
|
||||
- Step indicators (Setup → Options → Research → Results)
|
||||
- Navigation footer with Back/Next buttons
|
||||
- Responsive layout
|
||||
|
||||
**StepKeyword.tsx:**
|
||||
- Keywords textarea
|
||||
- Industry dropdown (16 options)
|
||||
- Target audience input
|
||||
- Validation for keyword requirements
|
||||
|
||||
**StepOptions.tsx:**
|
||||
- Three mode cards (Basic, Comprehensive, Targeted)
|
||||
- Visual selection feedback
|
||||
- Feature lists per mode
|
||||
- Hover effects
|
||||
|
||||
**StepProgress.tsx:**
|
||||
- Real-time progress updates
|
||||
- Progress messages display
|
||||
- Cancel button
|
||||
- Auto-advance to results on completion
|
||||
|
||||
**StepResults.tsx:**
|
||||
- Displays research results using existing `ResearchResults` component
|
||||
- Export JSON button
|
||||
- Start new research button
|
||||
|
||||
### 6. Hooks
|
||||
|
||||
**useResearchWizard.ts:**
|
||||
- State management for wizard steps
|
||||
- localStorage persistence
|
||||
- Step navigation (next/back)
|
||||
- Validation per step
|
||||
- Reset functionality
|
||||
|
||||
**useResearchExecution.ts:**
|
||||
- Research execution via API
|
||||
- Cache checking
|
||||
- Polling integration
|
||||
- Error handling
|
||||
- Progress tracking
|
||||
|
||||
### 7. Test Page (ResearchTest.tsx)
|
||||
|
||||
**Location:** `frontend/src/pages/ResearchTest.tsx`
|
||||
**Route:** `/research-test`
|
||||
|
||||
**Features:**
|
||||
- Quick preset buttons (3 samples)
|
||||
- Debug panel with JSON export
|
||||
- Performance metrics display
|
||||
- Cache state visualization
|
||||
- Research statistics summary
|
||||
|
||||
**Sample Presets:**
|
||||
1. AI Marketing Tools
|
||||
2. Small Business SEO
|
||||
3. Content Strategy
|
||||
|
||||
### 8. Type Definitions
|
||||
|
||||
**research.types.ts:**
|
||||
- `WizardState`
|
||||
- `WizardStepProps`
|
||||
- `ResearchWizardProps`
|
||||
- `ModeCardInfo`
|
||||
|
||||
**blogWriterApi.ts:**
|
||||
- `ResearchMode` type union
|
||||
- `SourceType` type union
|
||||
- `DateRange` type union
|
||||
- `ResearchConfig` interface
|
||||
- Updated `BlogResearchRequest` interface
|
||||
|
||||
---
|
||||
|
||||
## Integration
|
||||
|
||||
### 9. Blog Writer API (blogWriterApi.ts)
|
||||
|
||||
**Enhanced Interface:**
|
||||
```typescript
|
||||
export interface BlogResearchRequest {
|
||||
keywords: string[];
|
||||
topic?: string;
|
||||
industry?: string;
|
||||
target_audience?: string;
|
||||
tone?: string;
|
||||
word_count_target?: number;
|
||||
persona?: PersonaInfo;
|
||||
research_mode?: ResearchMode; // NEW
|
||||
config?: ResearchConfig; // NEW
|
||||
}
|
||||
```
|
||||
|
||||
### 10. App Routing (App.tsx)
|
||||
|
||||
**New Route:**
|
||||
```typescript
|
||||
<Route path="/research-test" element={<ResearchTest />} />
|
||||
```
|
||||
|
||||
### 11. Integration Adapter
|
||||
|
||||
**BlogWriterAdapter.tsx:**
|
||||
- Wrapper component for easy integration
|
||||
- Usage examples included
|
||||
- Clean interface for BlogWriter
|
||||
|
||||
---
|
||||
|
||||
## Documentation
|
||||
|
||||
### 12. Integration Guide
|
||||
|
||||
**File:** `docs/RESEARCH_COMPONENT_INTEGRATION.md`
|
||||
|
||||
**Contents:**
|
||||
- Architecture overview
|
||||
- Usage examples
|
||||
- Backend API details
|
||||
- Research modes explained
|
||||
- Configuration options
|
||||
- Testing instructions
|
||||
- Migration path
|
||||
- Troubleshooting guide
|
||||
|
||||
---
|
||||
|
||||
## Key Features
|
||||
|
||||
### Research Modes
|
||||
|
||||
**Basic Mode:**
|
||||
- Quick keyword analysis
|
||||
- Primary & secondary keywords
|
||||
- Trends overview
|
||||
- Top 5 content angles
|
||||
- Key statistics
|
||||
|
||||
**Comprehensive Mode:**
|
||||
- All basic features
|
||||
- Expert quotes & opinions
|
||||
- Competitor analysis
|
||||
- Market forecasts
|
||||
- Best practices & case studies
|
||||
- Content gaps identification
|
||||
|
||||
**Targeted Mode:**
|
||||
- Selectable components
|
||||
- Customizable filters
|
||||
- Date range options
|
||||
- Source type filtering
|
||||
|
||||
### User Experience
|
||||
|
||||
1. **Step-by-step wizard** with clear progress
|
||||
2. **Visual mode selection** with cards
|
||||
3. **Real-time progress** with live updates
|
||||
4. **Comprehensive results** with export capability
|
||||
5. **Error handling** with retry options
|
||||
6. **Cache integration** for instant results
|
||||
|
||||
### Developer Experience
|
||||
|
||||
1. **Modular architecture** - standalone components
|
||||
2. **Type safety** - full TypeScript interfaces
|
||||
3. **Reusable hooks** - state and execution management
|
||||
4. **Test page** - isolated testing environment
|
||||
5. **Documentation** - comprehensive guides
|
||||
|
||||
---
|
||||
|
||||
## Testing
|
||||
|
||||
### Quick Test
|
||||
|
||||
1. Navigate to `http://localhost:3000/research-test`
|
||||
2. Click "AI Marketing Tools" preset
|
||||
3. Select "Comprehensive" mode
|
||||
4. Watch progress updates
|
||||
5. Review results with export
|
||||
|
||||
### Integration Test
|
||||
|
||||
1. Compare `/research-test` wizard UI
|
||||
2. Compare `/blog-writer` current UI
|
||||
3. Test both research workflows
|
||||
4. Verify caching works across both
|
||||
|
||||
---
|
||||
|
||||
## Backward Compatibility
|
||||
|
||||
- Existing API calls continue working
|
||||
- No breaking changes to BlogWriter
|
||||
- Optional parameters default to current behavior
|
||||
- Cache infrastructure shared
|
||||
- All existing features preserved
|
||||
|
||||
---
|
||||
|
||||
## File Summary
|
||||
|
||||
**Backend (4 files):**
|
||||
- Modified: `blog_models.py`, `research_service.py`
|
||||
- Created: `research_strategies.py`
|
||||
|
||||
**Frontend (13 files):**
|
||||
- Created: `ResearchWizard.tsx`, 4 step components, 2 hooks, types, utils, adapter, test page
|
||||
- Modified: `App.tsx`, `blogWriterApi.ts`
|
||||
|
||||
**Documentation (2 files):**
|
||||
- Created: `RESEARCH_COMPONENT_INTEGRATION.md`, `RESEARCH_WIZARD_IMPLEMENTATION.md`
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. ✅ **Test the wizard** at `/research-test`
|
||||
2. ✅ **Review integration guide** in docs
|
||||
3. ⏳ **Integrate into BlogWriter** using adapter (optional)
|
||||
4. ⏳ **Gather user feedback** on wizard vs CopilotKit UI
|
||||
5. ⏳ **Add more presets** if needed
|
||||
|
||||
---
|
||||
|
||||
## Benefits Delivered
|
||||
|
||||
- Modular & Pluggable: Standalone component
|
||||
- Testable: Dedicated test page
|
||||
- Backward Compatible: No breaking changes
|
||||
- Reusable: Can be used anywhere in the app
|
||||
- Extensible: Easy to add new modes or features
|
||||
- Documented: Comprehensive guides
|
||||
- Type Safe: Full TypeScript support
|
||||
- Production Ready: No linting errors
|
||||
|
||||
---
|
||||
|
||||
Implementation Date: Current Session
|
||||
Status: Complete & Ready for Testing
|
||||
|
||||
150
docs/WIX_SEO_METADATA_COMPLETE.md
Normal file
150
docs/WIX_SEO_METADATA_COMPLETE.md
Normal file
@@ -0,0 +1,150 @@
|
||||
# Complete Wix SEO Metadata Implementation
|
||||
|
||||
## 📊 SEO Metadata Generated vs Posted
|
||||
|
||||
### ✅ FULLY POSTED TO WIX
|
||||
|
||||
#### 1. **SEO Keywords** (in `seoData.settings.keywords`)
|
||||
- ✅ `focus_keyword` → Main keyword (`isMain: true`)
|
||||
- ✅ `blog_tags` → Additional keywords (`isMain: false`)
|
||||
- ✅ `social_hashtags` → Additional keywords (`isMain: false`)
|
||||
|
||||
#### 2. **Meta Tags** (in `seoData.tags`)
|
||||
- ✅ `meta_description` → `<meta name="description">`
|
||||
- ✅ `seo_title` → `<meta name="title">`
|
||||
|
||||
#### 3. **Open Graph Tags** (in `seoData.tags`)
|
||||
- ✅ `open_graph.title` → `og:title`
|
||||
- ✅ `open_graph.description` → `og:description`
|
||||
- ✅ `open_graph.image` → `og:image` (HTTP/HTTPS URLs only)
|
||||
- ✅ `og:type` → Always set to `article`
|
||||
- ✅ `open_graph.url` or `canonical_url` → `og:url`
|
||||
|
||||
#### 4. **Twitter Card Tags** (in `seoData.tags`)
|
||||
- ✅ `twitter_card.title` → `twitter:title`
|
||||
- ✅ `twitter_card.description` → `twitter:description`
|
||||
- ✅ `twitter_card.image` → `twitter:image` (HTTP/HTTPS URLs only)
|
||||
- ✅ `twitter_card.card` → `twitter:card` (default: `summary_large_image`)
|
||||
|
||||
#### 5. **Canonical URL** (in `seoData.tags`)
|
||||
- ✅ `canonical_url` → `<link rel="canonical">`
|
||||
|
||||
#### 6. **Blog Categories** (in `draftPost.categoryIds`)
|
||||
- ✅ `blog_categories` → Lookup/create categories → `categoryIds` (UUIDs)
|
||||
- **Implementation**: `lookup_or_create_categories()` method
|
||||
- **Behavior**: Case-insensitive lookup, auto-create if missing
|
||||
|
||||
#### 7. **Blog Tags** (in `draftPost.tagIds`)
|
||||
- ✅ `blog_tags` → Lookup/create tags → `tagIds` (UUIDs)
|
||||
- **Implementation**: `lookup_or_create_tags()` method
|
||||
- **Behavior**: Case-insensitive lookup, auto-create if missing
|
||||
- **Note**: `blog_tags` are also used in SEO keywords, but separately as post tags
|
||||
|
||||
### ❌ NOT POSTED (Optional/Future)
|
||||
|
||||
1. **JSON-LD Structured Data** (`json_ld_schema`)
|
||||
- **Reason**: Wix doesn't support JSON-LD in backend API
|
||||
- **Solution**: Would require frontend implementation using `@wix/site-seo` package
|
||||
- **Status**: Not implemented (would need to be added to Wix site code)
|
||||
|
||||
2. **URL Slug** (`url_slug`)
|
||||
- **Reason**: Wix auto-generates URLs from title
|
||||
- **Status**: Could be implemented if Wix API supports custom slugs
|
||||
|
||||
3. **Reading Time** (`reading_time`)
|
||||
- **Reason**: Metadata only, not part of Wix blog post structure
|
||||
- **Status**: Not applicable
|
||||
|
||||
4. **Optimization Score** (`optimization_score`)
|
||||
- **Reason**: Internal metadata for ALwrity, not Wix field
|
||||
- **Status**: Not applicable
|
||||
|
||||
## 🔄 Conversion Methods
|
||||
|
||||
### Markdown to Ricos Conversion
|
||||
|
||||
**Primary Method**: Wix Official Ricos Documents API
|
||||
- **Endpoint**: Tries multiple paths to find correct endpoint
|
||||
- **Benefits**: Official conversion, handles all edge cases
|
||||
- **Fallback**: Custom parser if API unavailable
|
||||
|
||||
**Fallback Method**: Custom Markdown Parser
|
||||
- **Location**: `backend/services/integrations/wix/content.py`
|
||||
- **Supports**: Headings, paragraphs, lists, bold, italic, links, images, blockquotes
|
||||
|
||||
## 📋 Complete Post Structure
|
||||
|
||||
When publishing to Wix, the blog post includes:
|
||||
|
||||
```json
|
||||
{
|
||||
"draftPost": {
|
||||
"title": "SEO optimized title",
|
||||
"memberId": "author-member-id",
|
||||
"richContent": { /* Ricos JSON document */ },
|
||||
"excerpt": "First 200 chars of content",
|
||||
"categoryIds": ["uuid1", "uuid2"], // From blog_categories
|
||||
"tagIds": ["uuid1", "uuid2"], // From blog_tags
|
||||
"media": { /* Cover image if provided */ },
|
||||
"seoData": {
|
||||
"settings": {
|
||||
"keywords": [
|
||||
{ "term": "main keyword", "isMain": true },
|
||||
{ "term": "tag1", "isMain": false },
|
||||
{ "term": "tag2", "isMain": false }
|
||||
]
|
||||
},
|
||||
"tags": [
|
||||
{ "type": "meta", "props": { "name": "description", "content": "..." } },
|
||||
{ "type": "meta", "props": { "name": "title", "content": "..." } },
|
||||
{ "type": "meta", "props": { "property": "og:title", "content": "..." } },
|
||||
{ "type": "meta", "props": { "property": "og:description", "content": "..." } },
|
||||
{ "type": "meta", "props": { "property": "og:image", "content": "..." } },
|
||||
{ "type": "meta", "props": { "property": "og:type", "content": "article" } },
|
||||
{ "type": "meta", "props": { "property": "og:url", "content": "..." } },
|
||||
{ "type": "meta", "props": { "name": "twitter:title", "content": "..." } },
|
||||
{ "type": "meta", "props": { "name": "twitter:description", "content": "..." } },
|
||||
{ "type": "meta", "props": { "name": "twitter:image", "content": "..." } },
|
||||
{ "type": "meta", "props": { "name": "twitter:card", "content": "summary_large_image" } },
|
||||
{ "type": "link", "props": { "rel": "canonical", "href": "..." } }
|
||||
]
|
||||
}
|
||||
},
|
||||
"publish": true
|
||||
}
|
||||
```
|
||||
|
||||
## ✅ Implementation Status
|
||||
|
||||
### Fully Implemented ✅
|
||||
- SEO keywords (main + additional)
|
||||
- Meta description and title
|
||||
- Open Graph tags (all standard fields)
|
||||
- Twitter Card tags (all standard fields)
|
||||
- Canonical URL
|
||||
- **Blog categories** (lookup/create)
|
||||
- **Blog tags** (lookup/create)
|
||||
- Wix Ricos API integration (with fallback)
|
||||
|
||||
### Partially Implemented ⚠️
|
||||
- Image handling (only HTTP/HTTPS URLs, base64 skipped)
|
||||
|
||||
### Not Implemented ❌
|
||||
- JSON-LD structured data (requires frontend)
|
||||
- URL slug customization
|
||||
- Reading time (not applicable)
|
||||
- Optimization score (not applicable)
|
||||
|
||||
## 🎯 Summary
|
||||
|
||||
**All major SEO metadata fields are now being posted to Wix:**
|
||||
- ✅ Keywords
|
||||
- ✅ Meta tags
|
||||
- ✅ Open Graph
|
||||
- ✅ Twitter Cards
|
||||
- ✅ Canonical URL
|
||||
- ✅ Categories (auto-lookup/create)
|
||||
- ✅ Tags (auto-lookup/create)
|
||||
|
||||
The only missing piece is JSON-LD structured data, which requires frontend implementation in the Wix site code using the `@wix/site-seo` package.
|
||||
|
||||
102
docs/WIX_SEO_METADATA_REVIEW.md
Normal file
102
docs/WIX_SEO_METADATA_REVIEW.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# Wix SEO Metadata Review
|
||||
|
||||
## SEO Metadata We Generate (`BlogSEOMetadataResponse`)
|
||||
|
||||
### Available Fields:
|
||||
1. ✅ **seo_title** - SEO optimized title
|
||||
2. ✅ **meta_description** - Meta description
|
||||
3. ✅ **url_slug** - URL slug for the blog post
|
||||
4. ✅ **blog_tags** - Array of tag strings (NOW being used for Wix post tags via lookup/create)
|
||||
5. ✅ **blog_categories** - Array of category strings (NOW being used for Wix post categories via lookup/create)
|
||||
6. ✅ **social_hashtags** - Hashtags for social media
|
||||
7. ✅ **open_graph** - Open Graph metadata object:
|
||||
- title
|
||||
- description
|
||||
- image
|
||||
- url
|
||||
- type
|
||||
8. ✅ **twitter_card** - Twitter Card metadata object:
|
||||
- title
|
||||
- description
|
||||
- image
|
||||
- card (type)
|
||||
9. ✅ **canonical_url** - Canonical URL
|
||||
10. ✅ **focus_keyword** - Main SEO keyword
|
||||
11. ❌ **json_ld_schema** - JSON-LD structured data (NOT being posted - would need frontend implementation)
|
||||
12. ❌ **schema** - Legacy schema field (NOT being used)
|
||||
13. ❌ **reading_time** - Estimated reading time (NOT being posted)
|
||||
14. ❌ **optimization_score** - SEO optimization score (NOT being posted)
|
||||
15. ❌ **generated_at** - Generation timestamp (NOT being posted)
|
||||
|
||||
## What We're Currently Posting to Wix
|
||||
|
||||
### ✅ Posted via `seoData`:
|
||||
- **Keywords** (from `focus_keyword`, `blog_tags`, `social_hashtags`)
|
||||
- Main keyword: `focus_keyword` → `isMain: true`
|
||||
- Additional keywords: `blog_tags` and `social_hashtags` → `isMain: false`
|
||||
- **Meta Tags**:
|
||||
- `meta description` → `<meta name="description">`
|
||||
- `seo_title` → `<meta name="title">`
|
||||
- **Open Graph Tags**:
|
||||
- `og:title`, `og:description`, `og:image`, `og:type`, `og:url`
|
||||
- **Twitter Card Tags**:
|
||||
- `twitter:title`, `twitter:description`, `twitter:image`, `twitter:card`
|
||||
- **Canonical URL**:
|
||||
- `<link rel="canonical">`
|
||||
|
||||
### ✅ NOW Being Posted (Recently Implemented):
|
||||
|
||||
1. **Blog Categories** (`blog_categories`)
|
||||
- ✅ **Implemented**: `lookup_or_create_categories()` method
|
||||
- ✅ **Behavior**: Case-insensitive lookup, auto-create if missing
|
||||
- ✅ **Result**: Categories from SEO metadata are posted as `categoryIds` (UUIDs)
|
||||
|
||||
2. **Blog Tags** (`blog_tags` for post organization)
|
||||
- ✅ **Implemented**: `lookup_or_create_tags()` method
|
||||
- ✅ **Behavior**: Case-insensitive lookup, auto-create if missing
|
||||
- ✅ **Result**: Tags from SEO metadata are posted as `tagIds` (UUIDs)
|
||||
- **Note**: `blog_tags` are used BOTH for SEO keywords AND for Wix post tags
|
||||
|
||||
3. **JSON-LD Structured Data** (`json_ld_schema`)
|
||||
- **Issue**: Wix doesn't support JSON-LD in backend API
|
||||
- **Solution**: Would need frontend implementation using `@wix/site-seo` package
|
||||
- **Status**: Not implemented
|
||||
|
||||
4. **URL Slug** (`url_slug`)
|
||||
- **Issue**: Not being passed to Wix
|
||||
- **Status**: Wix generates URL automatically, but we could potentially set it
|
||||
|
||||
## Implementation Status
|
||||
|
||||
### ✅ Fully Implemented:
|
||||
- SEO keywords in `seoData.settings.keywords`
|
||||
- Meta description tag
|
||||
- SEO title tag
|
||||
- Open Graph tags (title, description, image, type, url)
|
||||
- Twitter Card tags (title, description, image, card type)
|
||||
- Canonical URL link tag
|
||||
|
||||
### ✅ Fully Implemented:
|
||||
- **Blog Categories**: Auto-lookup/create from `blog_categories`
|
||||
- **Blog Tags**: Auto-lookup/create from `blog_tags`
|
||||
- **Wix Ricos API Integration**: Uses official Wix API with fallback to custom parser
|
||||
|
||||
### ❌ Not Implemented (Optional):
|
||||
- JSON-LD structured data (frontend only - requires `@wix/site-seo` package)
|
||||
- URL slug setting (Wix auto-generates URLs)
|
||||
- Reading time (metadata only, not applicable)
|
||||
- Optimization score (metadata only, not applicable)
|
||||
|
||||
## Summary
|
||||
|
||||
✅ **All major SEO metadata is now being posted to Wix:**
|
||||
- SEO keywords (main + additional)
|
||||
- Meta tags (description, title)
|
||||
- Open Graph tags (title, description, image, type, url)
|
||||
- Twitter Card tags (title, description, image, card type)
|
||||
- Canonical URL
|
||||
- **Blog Categories** (auto-lookup/create)
|
||||
- **Blog Tags** (auto-lookup/create)
|
||||
|
||||
The only missing piece is JSON-LD structured data, which requires frontend implementation in the Wix site code using `@wix/site-seo` package (not a backend concern).
|
||||
|
||||
Reference in New Issue
Block a user