peptide-repo-core v0.6.1: fix Yoast webpage-type TypeError on singular pages (#20)

Accept string|array in retype_to_medical_webpage (Yoast wpseo_schema_webpage_type passes array on singular pages); normalize @type comparison; add regression test.

QA: APPROVE — qa-reviews/peptide-repo-core/2026-06-13-077c4b0e518f682721abe6a115eac9bb2bf18186.md

Agent-Session: jsonld-webpage-typefix v0.6.1 merge
This commit is contained in:
peptiderepo
2026-06-13 13:52:46 +07:00
committed by GitHub
parent e9d97b51e2
commit 118f301705
4 changed files with 192 additions and 9 deletions

View File

@@ -3,6 +3,13 @@
All notable changes to Peptide Repo Core are documented here.
Format: [Semantic Versioning](https://semver.org/).
## [0.6.1] — 2026-06-13
### Fixed
- Fix: Yoast `wpseo_schema_webpage_type` passes `string|array` on singulars — accept `string|array` in `retype_to_medical_webpage()` signature; return type updated to match (PHP 8.1+ union). Eliminates `TypeError` → HTTP 500 on all singular pages (monographs + plain Pages) under `strict_types=1`.
- Fix: `enrich_webpage_piece` compared `'WebPage' === $piece['@type']` but Yoast sets `@type` as an array on singular pages. Normalise `@type` to array before `in_array()` check; `lastReviewed`, `reviewedBy`, and `audience` now inject correctly.
- Add regression test `tests/unit/test-jsonld-webpage.php`: exercises `retype_to_medical_webpage()` with array input for peptide and non-peptide contexts (no TypeError), and `enrich_webpage_piece` with `@type` as array (enrichment injects). Tests fail against v0.6.0, pass after fix.
## [0.6.0] — 2026-06-13
### Added