CMSgov / design-system

Open source design and front-end development resources for creating Section 508 compliant, responsive, and consistent websites.
https://design.cms.gov
Other
312 stars 85 forks source link

[NO-TICKET] Fix Gatsby static image paths for archives and demos #3176

Closed pwolfert closed 1 month ago

pwolfert commented 1 month ago

Summary

Fix gatsby static images so they include the prefix path.

Previously if we built the doc site with a prefix path (like https://design.cms.gov/v/9.0.0/blog/release-7.0 having a prefix path of /v/9.0.0), the img src attribute would omit this prefix path and just assume the image was at /static/whatever-the-filename-is. Overriding this element ensures we include the prefix path always.

If you go look at https://design.cms.gov/v/9.0.0/blog/release-7.0, you'll notice that the image is being pulled from /static, which is actually from the root website, not this archived website. Unfortunately this bug will exist in all the old archived copies.

This also fixes the demo branches, which is why I updated the deploy-demo script in this commit.

How to test

Take a look at this demo, which now has a working image with the correct prefix path. Previously this blog-post image failed to load.

Checklist