# Blog Image Alt Text Audit Report

**Last Updated:** 2026-03-29

## Summary

| Audit | Scope | Total | Issues | Status |
|-------|-------|-------|--------|--------|
| Featured images | All posts | 404 | 0 | Fixed 2026-03-29 (`fix-featured-image-alt.php --all`, 50 Titel/Alt-Abweichungen; Snapshot `docs/backups/blog-snapshots/2026-03-29-170829`). Zuvor 2026-03-17 (28 Mismatches nach SEO-Normalisierung). |
| Inline content images | All posts | 15 images in 7 posts | 0 | All OK |
| Content images (dimensions) | All posts | 1018 images | 0 | Fixed 2026-03-17 (was 109 missing) |

## Standard

**Featured image alt:** `{Post Title} | Ordio` (max 150 chars)

- Post title = H1/descriptive title from post JSON
- Aligns with PostHeader.php fallback: `$image_alt = $image_data['alt'] ?: $title`
- Never start with "image of", "photo of", "picture of"; decorative images use `alt=""`

## Featured Image Audit (audit-blog-image-alt.php)

**Run:** `php v2/scripts/blog/audit-blog-image-alt.php` or `--category=lexikon` or `--format=csv`

**Findings (2026-03-29):**

- **404 posts with Featured Image OK** – `audit-blog-image-alt.php` Exit 0 nach `fix-featured-image-alt.php --all` (50 Korrekturen: Titel und `featured_image.alt` wieder identisch per `{Titel} | Ordio`-Regel).

**Findings (2026-03-17):**

- **349 posts OK** – all alt match standard after batch fix
- **Audit/fix alignment:** Audit script uses same deduplication logic as fix script (if title ends with "Ordio", expected alt = title as-is; else append " | Ordio")
- **Post-SEO-normalize fix:** After `normalize-seo-titles.php` + `sync-meta-to-posts.php`, 28 posts had alt longer than truncated title; fixed via `fix-featured-image-alt.php --all`

**Issue types:**

- `mismatch` – alt text does not equal `{Post Title} | Ordio` (with deduplication)
- No empty/missing alt, no length > 150, no bad prefixes found

## Inline Content Image Audit (audit-content-image-alt.py)

**Run:** `python3 v2/scripts/blog/audit-content-image-alt.py` or `--category=lexikon` or `--format=csv`

**Findings (2026-03-17):**

- **7 posts** have inline images
- **15 total inline images**
- **0 issues** – all have valid alt (present, non-empty, ≤ 150 chars, no bad prefixes)
- **fix-image-attributes.py:** Fixed 35 posts for HTML `<img>` tags (alt, loading, width, height)

## Content Image Dimensions (audit-image-dimensions.py)

**Run:** `python3 v2/scripts/blog/audit-image-dimensions.py`

**Findings (2026-03-17):**

- **358 posts OK** – 0 content images missing dimensions
- **Previous:** 97 posts had 109 content images missing width/height in `images` array
- **Fix:** `fix-content-image-dimensions.py` – reads dimensions from filenames, SVG defaults, or PIL

## Fix Script

**Batch fix:** `php v2/scripts/blog/fix-featured-image-alt.php --all` or `--post=slug` or `--category=lexikon`

- Sets `featured_image.alt = post.title + " | Ordio"` when alt is empty or mismatched
- Uses load→modify→dump (blog-json-edit-prohibition compliant)
- **Run backup first:** `python3 v2/scripts/blog/backup-blog-content.py --manual`

## Validation

**Featured image alt validator:** `php v2/scripts/blog/validate-featured-image-alt.php`

- Checks: alt present, non-empty, length ≤ 150, no "image of" prefix
- Integrated into `validate-new-post.php`

## Optional: Browser Accessibility Test

Use WAVE or axe DevTools on sample posts (e.g. krankmeldung, probezeit, leitfaden-zur-finanzbuchhaltung) to verify:

- Images have alt
- No "image of" prefix
- Screen reader announces correctly

## Related Documentation

- [BLOG_IMAGE_ALT_GUIDELINES.md](./BLOG_IMAGE_ALT_GUIDELINES.md)
- [BLOG_FEATURED_IMAGE_GENERATION.md](./BLOG_FEATURED_IMAGE_GENERATION.md)
- [BLOG_CONTENT_EDIT_WORKFLOW.md](./BLOG_CONTENT_EDIT_WORKFLOW.md)
- `.cursor/rules/blog-featured-image-style.mdc`
