# Script Issues & Fixes: Ruhezeiten

**Last Updated:** 2026-03-16

## Issues Encountered

### 1. FAQ Generation Script Skipped Relevant Questions

**Script:** `generate-faq-questions.php`

**Issue:** Script skipped many manually curated PAA questions from `paa-questions-manual.json` due to low relevance scores or perceived duplicates, even though they were topic-appropriate for labor law "Ruhezeiten."

**Solution:** Manually created `faq-answers-manual.json` with 17 comprehensive FAQ answers based on the main post content.

**Impact:** Low - Manual workaround was effective, but script could be improved to better handle manual PAA overrides.

### 2. FAQ Integration Script Failed

**Script:** `add-faqs-to-post.php`

**Issue:** Script did not add FAQs from `faq-answers-manual.json` when using `--source` parameter. The script expected FAQ data directly in a `faqs` or `answers` array in the provided `--faqs` file, or to auto-detect `faq-answers-optimized.json`. The manual file was named `faq-answers-manual.json` and contained a `faqs` array, but the script did not correctly process it via the `--source` parameter.

**Solution:** Manually inserted the `faqs` array directly into the post's JSON structure using `search_replace`.

**Impact:** Low - Manual workaround was effective, but script parameter handling could be improved.

### 3. Lead Capture Copy Script Missing Benefit Mapping

**Script:** `generate-lead-capture-copy.php`

**Issue:** Script failed with error: "No benefit mapping for slug 'ruhezeiten'. Add to _slugToBenefit() or write copy manually."

**Solution:** Manually added lead capture copy to `v2/data/lead_capture_copy.php` with appropriate headline and description.

**Impact:** Low - Manual workaround was effective, but benefit mapping could be added to script for future posts.

### 4. Related Posts Format Validation Warning

**Script:** `validate-new-post.php`

**Issue:** Script warned about missing slug/category in related_posts (was using string format instead of object format).

**Solution:** Updated related_posts to use object format with slug and category fields:
```json
{
  "slug": "fruehschicht",
  "category": "lexikon"
}
```

**Impact:** Low - Quick fix, validation script correctly identified the issue.

### 5. Backup Script Not Available

**Script:** `backup-blog-content.py`

**Issue:** Script not found at expected path (`v2/scripts/blog/backup-blog-content.py`).

**Solution:** Used `sync-meta-to-posts.php` which created a backup during sync operation.

**Impact:** Low - Alternative backup method was available.

## Scripts That Worked Correctly

- ✅ `create-new-blog-post.php` - Scaffolded post successfully
- ✅ `run-new-post-pipeline.php` - Collected SISTRIX data and competitor analysis
- ✅ `update-post-content.php` - Applied content successfully (after fixing parameter name)
- ✅ `validate-faq-schema.php` - Validated FAQ schema correctly
- ✅ `validate-faq-quality.php` - Assessed FAQ quality correctly
- ✅ `compare-content-to-competitors.php` - Compared content depth correctly
- ✅ `validate-section-depth.php` - Validated section depth correctly
- ✅ `validate-content-completeness.php` - Validated content completeness correctly
- ✅ `validate-content-flow.php` - Validated content flow correctly
- ✅ `validate-link-quality.php` - Validated link quality correctly
- ✅ `validate-anchor-text-quality.php` - Validated anchor text correctly
- ✅ `validate-schema.php` - Validated schema correctly
- ✅ `generate-blog-featured-image.py` - Generated featured image successfully
- ✅ `add-new-post-to-related-carousels.php` - Updated related posts successfully
- ✅ `update-lexikon-tracking.py` - Updated tracking successfully
- ✅ `sync-meta-to-posts.php` - Synced SEO meta successfully

## Recommendations

1. **Improve FAQ Generation Script:** Enhance `generate-faq-questions.php` to better handle manual PAA overrides and respect manual question priorities.

2. **Fix FAQ Integration Script:** Improve `add-faqs-to-post.php` to correctly handle `--source` parameter and manual FAQ files.

3. **Add Benefit Mapping:** Add "ruhezeiten" benefit mapping to `generate-lead-capture-copy.php` for future posts.

4. **Document Backup Process:** Clarify backup script location or update documentation to reflect alternative backup methods.

5. **Related Posts Format:** Consider updating scaffold script to use object format for related_posts by default.

## Notes

All script issues were resolved with manual workarounds. The post was successfully created and validated despite these minor script limitations.
