# content-compare — WP rebuild vs live, page by page

Catches subtle human content-entry errors between **brentwooddev (WP rebuild)** and
**live brentwood.ca**: changed/missing text, changed link text or targets, and the
**wrong/missing image** (matched by filename id, so re-crops don't false-positive) plus
**lost alt text**. Built because these slips are very hard for humans to spot.

**Scope:** pages + landing pages only. Blogs / courses / staff were imported directly, so
they're not compared.

## Run it
```bash
compare-pages /why-brentwood/ /admissions/     # specific pages
compare-pages --all                             # every published page + landing
```
(or `bash /srv/apps/brentwood/tools/content-compare/compare-pages.sh ...`)

Output: a timestamped folder under `reports/`. Open **`combined.html`** (one file,
worst pages first) or `index.html`. Live images load from brentwood.ca; rebuild
images need the demoing gate cookie in your browser.

## How it works (no docker, no gate needed to RUN it)
- Fetches both sides **locally**: WP via `172.17.0.1:3097` (Host brentwooddev.demoing.info),
  live via the **Laravel mirror** `172.17.0.1:3082` (Host brentwood.demoing.info) — a synced
  copy of brentwood.ca. **Re-sync the mirror first for an up-to-date live** (`sync-mirror.sh`,
  owner only) or results reflect the last sync.
- Compares only the **main content region** (`main` on WP, `#main` on live); header / mega-menu /
  footer-CTA are stripped so template chrome doesn't create noise.
- Images are matched by **filename tokens** (the import keeps the source photo id / name), so a
  genuinely wrong image shows as "missing on one side / extra on the other"; a re-crop does not.

## Files
- `compare.py` — the engine. Selectors/thresholds are constants at the top (`WP`, `LIVE`, …).
- `compare-pages.sh` — the runnable wrapper.
- `.venv/` — Python deps (requests, beautifulsoup4, lxml, Pillow, imagehash).
- `reports/` — output (gitignore-able; can be large).

## Known limits
- Reads server-rendered HTML; a **JS-built gallery** can under-count images on one side.
- Live `75p`/`100p` artifacts and a couple of template tokens can still show as minor text diffs.
- Mirror freshness = live freshness; re-sync before a real audit run.
