Skip to content

Replace external image URLs with local assets#23

Merged
goude merged 1 commit intomainfrom
claude/fix-broken-image-tests-Li0PW
Apr 4, 2026
Merged

Replace external image URLs with local assets#23
goude merged 1 commit intomainfrom
claude/fix-broken-image-tests-Li0PW

Conversation

@goude
Copy link
Copy Markdown
Owner

@goude goude commented Apr 4, 2026

Summary

This PR replaces external image URLs with locally hosted assets to improve performance, reliability, and reduce external dependencies.

Key Changes

  • Added a test suite (check-external-images.test.mjs) that validates no .astro files use external HTTP(S) URLs in <img src> attributes
  • Created a local placeholder SVG (public/placeholder.svg) to replace the external placeholder service
  • Updated src/pages/ai-generated/markup.astro to use the local placeholder SVG instead of https://via.placeholder.com/400x200
  • Updated src/pages/ai-generated/wall-of-sound/_Origins.astro to use a local image (/ai-generated/wall-of-sound/gold-star-studios.jpg) instead of the Wikimedia Commons URL

Implementation Details

  • The test uses regex pattern matching to detect <img> tags with external HTTP(S) URLs across multiline boundaries
  • Violations are reported with file path, line number, and a preview of the offending tag
  • The placeholder SVG is a simple 400×200 gray rectangle with centered text, suitable for layout purposes

https://claude.ai/code/session_01JQbTB41G3gCgvTUT3wqt8x

- Replace Wikimedia hotlink in wall-of-sound/_Origins.astro with local
  path /ai-generated/wall-of-sound/gold-star-studios.jpg (Wikimedia
  blocks hotlinking, causing the broken image on mobile). The image
  file still needs to be downloaded from Wikimedia Commons and placed
  at public/ai-generated/wall-of-sound/gold-star-studios.jpg.
- Replace https://via.placeholder.com/400x200 in markup.astro with
  local /placeholder.svg (added to public/).
- Add scripts/check-external-images.test.mjs: vitest test that scans
  all .astro source files for <img src="https?://..."> and fails if
  any are found, preventing this class of bug in future.

https://claude.ai/code/session_01JQbTB41G3gCgvTUT3wqt8x
@goude goude merged commit a5d87d8 into main Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants