Fix schema-audit CLI checking no pages - #237
Merged
Merged
Conversation
The script appended paths that start with a slash to a site URL it had already given a trailing slash, so every request went to //path/. Sites answer that with a 301, and the audit skipped every page as not found: on imagewize.com it checked nothing and reported 0 of 11. Rebuilt along the lines of the schema_audit MCP fix: pages come from the site's sitemap (new --max-pages, default 25), with the common paths only as a fallback. Each page is fetched once instead of up to six times, non-200 URLs are listed separately with their redirect target, and --pages accepts full URLs. Also fixes the pages-needing-schema list, which was always empty: the grep -c fallback printed 0 twice and broke the numeric test. JSON-LD spanning several lines is now read, and Person is detected.
Only the top-level type field of each JSON-LD block was read, so the Organization, WebSite and BreadcrumbList nodes SEO plugins nest in a graph array went uncounted. The imagewize.com homepage reported none of the tracked types. The text fallback for unparseable JSON-LD also never matched, since it lowercased the schema but not the type it searched for.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Version:
5.24.3This release, 5.24.3, fixes two defects that made schema auditing report wrong results on real WordPress sites, one in the
wp-ops schema-auditCLI script and one in theschema_auditMCP tool. The CLI script added paths that start with/to a site URL that already ended in a slash, so every request went to//path/. Sites answered with a 301, every page was skipped, and on imagewize.com the script checked 0 of 11 pages. The script has been rebuilt to match the 5.24.2 MCP fix: it now takes its page list from the site's sitemap, lists non-200 URLs separately, and fetches each page once. The MCP tool read only the top-level@type, so the Organization, WebSite and BreadcrumbList nodes that SEO plugins nest in an@grapharray went uncounted. It now walks the whole JSON-LD tree.Schema Audit CLI Rebuild:
wp-sitemap.xml, thensitemap_index.xml, thensitemap.xml. From a sitemap index it reads only the page sitemaps. The homepage is always checked first, and the common paths are used only when a site has no sitemap. The output says when that fallback is used.--max-pagesflag (default 25) to cap how many sitemap pages are checked. The report says when the cap cuts the list short.grep -c ... || echo "0"fallback printed0twice and broke the numeric test. The list is now built during the audit.--pagesaccepts full URLs as well as paths.Personis now a detected type. This parsing needsperl, which comes with macOS and standard Linux servers.MCP
schema_auditTool:checkSchemaTypesinmcp-server/src/tools/schemaAudit.tsnow collects every@typevalue anywhere in the JSON-LD tree. This catches the nodes that Yoast, Rank Math and The SEO Framework nest inside@graph.@typearrays.Catalog and Documentation:
wp-cli/seo/schema-auditentry ingo/internal/catalog/catalog.jsonwith the new description, theperlrequirement, the new--max-pagesargument, and the updated--pageswording.wp-cli/seo/README.mdto cover sitemap discovery, the page cap, the non-200 handling and the full list of detected types. Added usage examples for--max-pages,--pagesand--output.CHANGELOG.md.Files Changed:
CHANGELOG.md(Modified)go/internal/catalog/catalog.json(Modified)mcp-server/src/tools/schemaAudit.ts(Modified)wp-cli/seo/README.md(Modified)wp-cli/seo/schema-audit.sh(Modified)