#!/bin/bash # Audit script to identify missing image references echo "=== Image Reference Audit ===" echo "" echo "Finding all image references in articles..." echo "" REFS=$(grep -rh '!\[' content/articles/ 2>/dev/null | grep -oE '\(/img/[^)]+\)' | sed 's/(//' | sed 's/)//' | sort -u) echo "Total image references found: $(echo "$REFS" | wc -l)" echo "" echo "Checking which exist in /public/img/:" echo "" MISSING_COUNT=0 EXISTING_COUNT=0 while read -r ref; do if [ -z "$ref" ]; then continue; fi filename=$(basename "$ref") fullpath="/Users/jennie/Sites/wiki-ghostguild${ref}" if [ -f "$fullpath" ]; then echo "✓ $filename" ((EXISTING_COUNT++)) else echo "✗ MISSING: $filename" ((MISSING_COUNT++)) fi done <<< "$REFS" echo "" echo "=== Summary ===" echo "Existing images: $EXISTING_COUNT" echo "Missing images: $MISSING_COUNT" echo "" echo "Missing images need to be added to /public/img/ or updated in article markdown."