Loading
feat: add social_preview check for Open Graph meta tags
Plan
Add a new social_preview check to detect Open Graph meta tags (og:title and og:image) that enable rich link previews when shared on social networks and messaging apps.
Changes
- Added
social_previewcheck class inapp/checks.pywith pass/warn/fail logic:- Pass: Both og:title and og:image tags present
- Warn: Only one of the two tags present
- Fail: Neither tag present
- Registered the check in CHECK_DEFINITIONS with 0.5 weight (small weight as specified)
- Added comprehensive test cases in
app/tests/test_checks.py:- Test for pass scenario (both tags present)
- Test for warn scenarios (only title or only image)
- Test for fail scenario (no tags)
- Test for case-insensitive property matching
- Test for empty content handling
- Updated GOOD_HTML test fixture to include og:title and og:image for consistent test results
- Integrated check into
evaluate_page()function to run on all page evaluations
Test evidence
$ ruff check . && ruff format --check . && pytest -q
All checks passed!
29 files already formatted
........................................................................ [ 37%]
........................................................................ [ 75%]
............................................... [100%]All tests pass including:
- Unit tests for all three states (pass, warn, fail)
- Integration tests verifying the check appears in evaluate_page results
- API tests confirming the check is included in reports and score calculation
- Code quality checks (ruff) pass without issues
Closes #2 (closed)