# Analysis Scripts Guide

**Last Updated:** 2026-01-19

Complete guide to all analysis scripts available for blog post improvement, including content analysis, SEO analysis, link analysis, and FAQ analysis capabilities.

## Overview

This guide documents all analysis scripts used to analyze blog posts, identify improvement opportunities, and validate content quality. These scripts analyze collected data and generate insights for content improvement.

## Script Categories

### 1. Content Analysis Scripts

### 2. SEO Analysis Scripts

### 3. Link Analysis Scripts

### 4. FAQ Analysis Scripts

### 5. Performance Analysis Scripts

### 6. Validation Scripts

## Content Analysis Scripts

### analyze-post-content.php

**Purpose:** Analyze blog post content structure, quality, and flow

**Location:** `v2/scripts/blog/analyze-post-content.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/analyze-post-content.php --post=slug --category=category

# All posts
php v2/scripts/blog/analyze-post-content.php --all

# With limit
php v2/scripts/blog/analyze-post-content.php --all --limit=20
```

**Analysis Performed:**

- Word count assessment
- Content depth rating (Shallow/Basic/Moderate/Deep/Comprehensive)
- FAQ count and quality
- Content structure review
- Content gaps identification
- Definition placement check
- Heading hierarchy validation

**Output:** `docs/content/blog/posts/{category}/{slug}/data/content-analysis.json`

**Key Metrics:**

- Word count
- Content depth score
- FAQ count
- Heading structure
- Definition position
- Flow score

**Best Practices:**

- Run before content improvement
- Use to identify content gaps
- Check definition placement
- Validate content structure

### analyze-content-flow.php

**Purpose:** Analyze content flow and logical structure

**Location:** `v2/scripts/blog/analyze-content-flow.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/analyze-content-flow.php --post=slug --category=category

# All posts
php v2/scripts/blog/analyze-content-flow.php --all
```

**Analysis Performed:**

- Definition placement (flags if >30%)
- FAQ sections in content (should be none)
- Heading hierarchy validation
- Content flow score
- Logical progression check

**Output:** Console output with flow analysis

**Key Checks:**

- Definition within first 20% of content
- No FAQ sections in content HTML
- Proper heading hierarchy
- Smooth transitions
- Logical flow

**Best Practices:**

- Run after content creation
- Fix flow issues before publication
- Target flow score: ≥80/100

### analyze-content-structure.py

**Purpose:** Analyze content structure and HTML organization

**Location:** `v2/scripts/blog/analyze-content-structure.py`

**Usage:**

```bash
# Single post
python3 v2/scripts/blog/analyze-content-structure.py --post=slug --category=category

# All posts
python3 v2/scripts/blog/analyze-content-structure.py --all
```

**Analysis Performed:**

- HTML structure analysis
- Heading hierarchy
- Paragraph structure
- List usage
- Table usage
- Image placement

**Output:** Structure analysis report

**Best Practices:**

- Use for HTML structure validation
- Check heading hierarchy
- Validate content organization

## SEO Analysis Scripts

### analyze-post-seo.php

**Purpose:** Analyze SEO performance and optimization opportunities

**Location:** `v2/scripts/blog/analyze-post-seo.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/analyze-post-seo.php --post=slug --category=category

# All posts
php v2/scripts/blog/analyze-post-seo.php --all
```

**Analysis Performed:**

- Primary and secondary keywords
- LSI keywords
- Keyword performance (GSC, SISTRIX)
- Meta tags review
- Schema markup status
- SEO score (0-100)

**Output:** `docs/content/blog/posts/{category}/{slug}/data/seo-analysis.json`

**Key Metrics:**

- SEO score
- Keyword coverage
- Meta tag optimization
- Schema markup completeness
- Internal linking score

**Best Practices:**

- Run after data collection
- Use to identify SEO opportunities
- Check keyword integration
- Validate schema markup

### analyze-seo-meta.php

**Purpose:** Analyze SEO meta tags across all posts

**Location:** `v2/scripts/blog/analyze-seo-meta.php`

**Usage:**

```bash
# Analyze all posts
php v2/scripts/blog/analyze-seo-meta.php --all

# Specific category
php v2/scripts/blog/analyze-seo-meta.php --category=ratgeber
```

**Analysis Performed:**

- Title tag analysis
- Meta description analysis
- Keyword integration
- Length validation
- Uniqueness check

**Output:** SEO meta analysis report

**Best Practices:**

- Run periodically to check meta tag quality
- Identify optimization opportunities
- Fix duplicate meta tags

## Link Analysis Scripts

### analyze-post-links.php

**Purpose:** Analyze internal linking structure and opportunities

**Location:** `v2/scripts/blog/analyze-post-links.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/analyze-post-links.php --post=slug --category=category

# All posts
php v2/scripts/blog/analyze-post-links.php --all
```

**Analysis Performed:**

- Current links inventory
- Related posts carousel review
- Link quality assessment
- Missing link opportunities
- Cross-page type linking strategy
- Anchor text analysis

**Output:** `docs/content/blog/posts/{category}/{slug}/data/links-analysis.json`

**Key Metrics:**

- Link count
- Link types distribution
- Anchor text quality
- Missing link opportunities
- Related posts coverage

**Best Practices:**

- Run before adding links
- Use to identify linking opportunities
- Check anchor text quality
- Validate link relevance

### analyze-link-quality.php

**Purpose:** Analyze internal link quality and anchor text

**Location:** `v2/scripts/blog/analyze-link-quality.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/analyze-link-quality.php --post=slug --category=category

# All posts
php v2/scripts/blog/analyze-link-quality.php --all
```

**Analysis Performed:**

- Anchor text quality
- Link relevance
- Link placement
- Anchor text variation
- Generic anchor text detection

**Output:** Link quality report

**Best Practices:**

- Run after adding links
- Fix low-quality links
- Improve anchor text
- Ensure natural integration

### analyze-anchor-text.py

**Purpose:** Analyze anchor text patterns and quality

**Location:** `v2/scripts/blog/analyze-anchor-text.py`

**Usage:**

```bash
# Single post
python3 v2/scripts/blog/analyze-anchor-text.py --post=slug --category=category

# All posts
python3 v2/scripts/blog/analyze-anchor-text.py --all
```

**Analysis Performed:**

- Anchor text patterns
- Repetition detection
- Generic anchor text detection
- Keyword-rich anchor text analysis

**Output:** Anchor text analysis report

**Best Practices:**

- Use to identify anchor text issues
- Fix repetitive anchor text
- Improve anchor text quality

## FAQ Analysis Scripts

### comprehensive-faq-analysis.php

**Purpose:** Comprehensive FAQ quality analysis (all quality checks)

**Location:** `v2/scripts/blog/comprehensive-faq-analysis.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/comprehensive-faq-analysis.php --post=slug --category=category

# All posts
php v2/scripts/blog/comprehensive-faq-analysis.php --all
```

**Analysis Performed:**

- Topic relevance validation
- Pattern violation detection
- Duplicate question detection
- Ordering analysis
- SEO analysis (GSC queries, keywords)
- Uniqueness check

**Output:** Comprehensive FAQ analysis report

**Key Checks:**

- Topic relevance (≥ 0.3)
- No pattern violations
- No duplicate questions (similarity < 0.7)
- Logical ordering
- SEO optimization

**Best Practices:**

- Run before FAQ review
- Fix all quality issues
- Use for comprehensive quality check

### analyze-faq-ordering.php

**Purpose:** Analyze FAQ ordering and logical flow

**Location:** `v2/scripts/blog/analyze-faq-ordering.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/analyze-faq-ordering.php --post=slug --category=category

# All posts
php v2/scripts/blog/analyze-faq-ordering.php --all
```

**Analysis Performed:**

- Logical flow check
- Ordering suggestions
- Question type categorization
- Priority ordering validation

**Output:** FAQ ordering analysis

**Best Practices:**

- Run to check FAQ order
- Use `reorder-faqs-by-logical-flow.php --write` to apply logical ordering to existing posts

### reorder-faqs-by-logical-flow.php

**Purpose:** Reorder FAQs in a post by logical flow (definition → how-to → requirements → when/which → yes/no → duration → other)

**Location:** `v2/scripts/blog/reorder-faqs-by-logical-flow.php`

**Usage:**

```bash
# Dry-run (preview order)
php v2/scripts/blog/reorder-faqs-by-logical-flow.php --post=slug --category=category

# Apply changes
php v2/scripts/blog/reorder-faqs-by-logical-flow.php --post=slug --category=category --write
```

**When to use:** For existing posts with unordered FAQs. New FAQs added via `add-faqs-to-post.php` are sorted automatically.

### analyze-faqs-seo.php

**Purpose:** Analyze FAQ SEO optimization

**Location:** `v2/scripts/blog/analyze-faqs-seo.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/analyze-faqs-seo.php --post=slug --category=category

# All posts
php v2/scripts/blog/analyze-faqs-seo.php --all
```

**Analysis Performed:**

- GSC query coverage
- Keyword integration
- PAA question coverage
- Duplicate detection
- SEO score

**Output:** FAQ SEO analysis

**Best Practices:**

- Run to check SEO optimization
- Ensure top GSC queries addressed
- Check keyword integration

### check-faq-uniqueness.php

**Purpose:** Check FAQ uniqueness (questions and answers)

**Location:** `v2/scripts/blog/check-faq-uniqueness.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/check-faq-uniqueness.php --post=slug --category=category

# All posts
php v2/scripts/blog/check-faq-uniqueness.php --all
```

**Analysis Performed:**

- Question uniqueness (semantic similarity < 0.7)
- Answer uniqueness (content similarity < 0.6)
- Duplicate detection

**Output:** Uniqueness check report

**Best Practices:**

- Run before publishing FAQs
- Remove duplicate FAQs
- Ensure unique value

### validate-faq-topic-relevance.php

**Purpose:** Validate FAQ topic relevance

**Location:** `v2/scripts/blog/validate-faq-topic-relevance.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/validate-faq-topic-relevance.php --post=slug --category=category

# All posts
php v2/scripts/blog/validate-faq-topic-relevance.php --all
```

**Analysis Performed:**

- Topic relevance calculation (≥ 0.3)
- Off-topic FAQ detection
- Brand question detection (on non-brand posts)

**Output:** Topic relevance report

**Best Practices:**

- Run to check FAQ relevance
- Remove off-topic FAQs (relevance < 0.3)
- Ensure all FAQs relate to post topic

### detect-faq-patterns.php

**Purpose:** Detect nonsensical FAQ patterns

**Location:** `v2/scripts/blog/detect-faq-patterns.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/detect-faq-patterns.php --post=slug --category=category

# All posts
php v2/scripts/blog/detect-faq-patterns.php --all
```

**Analysis Performed:**

- Pattern violation detection
- Nonsensical patterns (cost/duration with abstract concepts)
- Brand questions on non-brand posts
- Malformed questions

**Output:** Pattern detection report

**Best Practices:**

- Run to detect pattern violations
- Remove high-severity violations
- Fix malformed questions

## Performance Analysis Scripts

### analyze-post-data.php

**Purpose:** Comprehensive post data analysis

**Location:** `v2/scripts/blog/analyze-post-data.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/analyze-post-data.php --post=slug --category=category

# All posts
php v2/scripts/blog/analyze-post-data.php --all
```

**Analysis Performed:**

- Content analysis
- SEO analysis
- Link analysis
- Performance analysis
- Comprehensive scoring

**Output:** Comprehensive analysis report

**Best Practices:**

- Run for complete post analysis
- Use for improvement planning
- Identify all improvement opportunities

## Validation Scripts

### validate-content-flow.php

**Purpose:** Validate content flow and structure

**Location:** `v2/scripts/blog/validate-content-flow.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/validate-content-flow.php --post=slug --category=category

# All posts
php v2/scripts/blog/validate-content-flow.php --all
```

**Validation Checks:**

- Definition placement (≤20%)
- FAQ sections in content (none)
- Heading hierarchy
- Content flow score (≥80/100)

**Output:** Validation report

**Best Practices:**

- Run before publication
- Fix all validation errors
- Ensure flow score ≥80

### validate-faq-schema.php

**Purpose:** Validate FAQ schema markup

**Location:** `v2/scripts/blog/validate-faq-schema.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/validate-faq-schema.php --post=slug --category=category

# All posts
php v2/scripts/blog/validate-faq-schema.php --all
```

**Validation Checks:**

- Schema syntax (valid JSON-LD)
- All FAQs included
- Schema answers match HTML answers
- No HTML in schema answers
- Proper structure

**Output:** Schema validation report

**Best Practices:**

- Run before publication
- Fix all schema errors
- Test with Google Rich Results Test

### validate-faq-quality.php

**Purpose:** Validate FAQ quality

**Location:** `v2/scripts/blog/validate-faq-quality.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/validate-faq-quality.php --post=slug --category=category

# All posts
php v2/scripts/blog/validate-faq-quality.php --all
```

**Validation Checks:**

- FAQ count (10-15 optimal)
- Answer length (40-80 words)
- Topic relevance (≥ 0.3)
- No duplicates
- Logical ordering

**Output:** Quality validation report

**Best Practices:**

- Run before publication
- Fix all quality issues
- Ensure all requirements met

### validate-documentation-quality.php

**Purpose:** Validate documentation completeness and quality

**Location:** `v2/scripts/blog/validate-documentation-quality.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/validate-documentation-quality.php --post=slug --category=category

# All posts
php v2/scripts/blog/validate-documentation-quality.php --all
```

**Validation Checks:**

- Manual sections present
- Automated sections populated
- No unpopulated placeholders
- Data integration complete
- File structure integrity

**Output:** Documentation quality report

**Best Practices:**

- Run after documentation generation
- Fix missing sections
- Complete all placeholders

## Documentation Generation Scripts

### generate-post-documentation.php

**Purpose:** Generate comprehensive post documentation

**Location:** `v2/scripts/blog/generate-post-documentation.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/generate-post-documentation.php --post=slug --category=category

# All posts
php v2/scripts/blog/generate-post-documentation.php --all
```

**Generated Files:**

- `POST_ANALYSIS.md` - Content analysis
- `SEO_REPORT.md` - SEO performance report
- `INTERNAL_LINKS.md` - Internal linking analysis
- `IMPROVEMENT_PLAN.md` - Improvement recommendations (Ratgeber/Lexikon only)

**Best Practices:**

- Run after data collection
- Review generated documentation
- Complete manual sections
- Use for improvement planning

### safe-regenerate-documentation.php

**Purpose:** Safely regenerate documentation while preserving manual edits

**Location:** `v2/scripts/blog/safe-regenerate-documentation.php`

**Usage:**

```bash
# Single post
php v2/scripts/blog/safe-regenerate-documentation.php --post=slug --category=category

# All posts
php v2/scripts/blog/safe-regenerate-documentation.php --all

# Dry run
php v2/scripts/blog/safe-regenerate-documentation.php --post=slug --category=category --dry-run
```

**Features:**

- Preserves manual sections
- Regenerates automated sections
- Safe to run multiple times

**Best Practices:**

- Use after data updates
- Always use safe regeneration
- Review changes after regeneration

## Quick Reference

### Complete Analysis Workflow

```bash
POST_SLUG="your-post-slug"
CATEGORY="ratgeber"

# Run all analyses
php v2/scripts/blog/analyze-post-content.php --post=$POST_SLUG --category=$CATEGORY
php v2/scripts/blog/analyze-post-seo.php --post=$POST_SLUG --category=$CATEGORY
php v2/scripts/blog/analyze-post-links.php --post=$POST_SLUG --category=$CATEGORY
php v2/scripts/blog/comprehensive-faq-analysis.php --post=$POST_SLUG --category=$CATEGORY

# Generate documentation
php v2/scripts/blog/generate-post-documentation.php --post=$POST_SLUG --category=$CATEGORY

# Validate
php v2/scripts/blog/validate-content-flow.php --post=$POST_SLUG --category=$CATEGORY
php v2/scripts/blog/validate-faq-schema.php --post=$POST_SLUG --category=$CATEGORY
php v2/scripts/blog/validate-faq-quality.php --post=$POST_SLUG --category=$CATEGORY
```

### Analysis Priorities

**Before Content Improvement:**

1. `analyze-post-content.php` - Content analysis
2. `analyze-post-seo.php` - SEO analysis
3. `analyze-post-links.php` - Link analysis
4. `comprehensive-faq-analysis.php` - FAQ analysis

**After Content Creation:**

1. `validate-content-flow.php` - Flow validation
2. `validate-faq-schema.php` - Schema validation
3. `validate-faq-quality.php` - Quality validation

## Related Documentation

- [Blog Post Improvement Process](BLOG_POST_IMPROVEMENT_PROCESS.md) - Complete improvement workflow
- [Data Collection Scripts Inventory](DATA_COLLECTION_SCRIPTS_INVENTORY.md) - Data collection scripts
- [Content Quality Checklist](CONTENT_QUALITY_CHECKLIST_IMPROVEMENT.md) - Quality standards
