Validate a built page’s canonical URL and title against its Open Graph and X (Twitter card) metadata, then compare the declared preview image dimensions with a local PNG. Duplicate fields, malformed URLs, missing image descriptions and identity mismatches are reported. This is an offline, read-only, zero-dependency Node.js 22+ check, not a prediction of social-platform rendering.
This walkthrough uses the tool's public README and checked-in example files. Run the command from a repository checkout with Node.js 22+; inspect the source before using it on your own files.
Run the checked-in example
node bin/open-graph-preview-validator.mjs --root examples --page pass.html
node bin/open-graph-preview-validator.mjs --root examples --page fail.html
npm run checkRead the result
The first example exits 0. The second exits 1 because OG and X image URLs disagree. Unreadable, out-of-root or unsupported local image evidence exits 2 as incomplete; it is never treated as a good preview. src/index.mjs exports TOOLID and validatePreview. See rules and limits.
Where this check stops
This local walkthrough does not establish the state of a live production system or replace the limits documented in the repository.
Before adapting the command to your own workflow, review the accepted inputs, exit codes and safety boundaries in the README.
Compiled with AI assistance from checked-in public documentation and example scripts. Run the example and review the repository's current documentation before relying on its result.