Worklog for task "Configure Open Graph / meta tags for correct page previews in messengers"

18 сент. 2026 г., 22:22:43

Enhanced og:image validation following Google errors

Google reported an "Invalid URL in image field" error for some product cards. The suspected cause is that the original image paths contained unencoded Cyrillic characters and spaces, which the previous validation did not catch.

The script agent/scripts/check-page-image/index.ts in the happybaby2000.ru project has been updated:

  • the original og:image value is checked prior to any normalization;
  • the URL must be an absolute HTTP(S) address with a host;
  • unencoded spaces, Cyrillic characters, control characters, and other invalid characters are detected;
  • the correctness of %-escape sequences is verified;
  • unencoded square brackets in the path/query/fragment and duplicate # characters in the fragment are detected, while IPv6 addresses in square brackets are permitted;
  • all og:image tags on the page are checked, not just the first one;
  • diagnostics indicate the image number, original URL, and the reason for the error; for invalid characters, the Unicode code and position are also output;
  • on errors, the script returns exit code 1, and on success — 0.

A regression test agent/scripts/check-page-image/index.test.ts using Vitest has been added alongside it. The Vitest configuration has been extended to cover scripts/**/*.test.ts. The test suite covers 28 scenarios, including valid and invalid URLs, encoded characters, IPv6, missing images, multiple og:image tags, and diagnostic precision.

The check runs successfully: 28 tests passed, ESLint, Prettier, and git diff --check — no errors.

Test command:

npm run test -- scripts/check-page-image/index.test.ts

Validation limitation: it validates the syntax of the URL from og:image, but does not check the availability of the image itself and does not guarantee that the URL will be accepted by Google services. The script does not perform automatic URL correction.

16.09.2026

Explicitly define preview metadata (title, description, image) for website pages so that messengers and social networks correctly generate link cards.