This repository was archived by the owner on Jan 16, 2024. It is now read-only.
forked from ethereum/ethereum-org-website
-
Notifications
You must be signed in to change notification settings - Fork 3
Implement blurred image placeholders #273
Merged
Conversation
This file contains 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
✅ Deploy Preview for ethereum-org-fork ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
removing "imageBlurData"
Implements a hash fingerprint for each image placeholder, to ensure the blurDataURL being obtained is from the exact same image data. Adds await to setImagePlaceholders function call, fixing markdown images not receiving blur data. Restructures cache data to use kebab-cased JSON files instead of nested directories.
Fixes frontmatter image blur data being ignored
pettinarip
approved these changes
Jan 11, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @wackerow!
LGTM!
only applies to markdown images
pettinarip
approved these changes
Jan 12, 2024
Bringing in and will open a PR with remaining Next.js fork repo changes against ethereum/ethereum-org-website:dev |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Markdown images (dynamically loaded)
getStaticProps
inside[...slug].tsx
plaiceholder
package used to generate base64 encoded blurred image placeholderHero image (from frontmatter, not part of markdown AST)
frontmatter.image
is available,blurDataURL
is generated and attached asfrontmatter.blurDataUrl
ImageInfo
interface updated to includeblurDataURL
property, alongsideimage
andalt
propertiesInternal markdown content images
rehypeImg.ts
plugin to walk markdown AST, looking for allimg
tags, adding to an arraysrc/data/placeholders
checked first to see if base64 data is already availablegetPlaiceholder
to generate base64 encoded placeholder, which is then saved to cache for future usage.blurDataUrl
node propertyExternal markdown content images (http*)
rehypeImg.ts
pluginStatically loaded images in React pages/components
import SomeImage from "/path/to/image.ext"
) include blurDataURL in the image component (SomeImage.blurDataURL
), which is passed as imagesrc
All images
Image
component updated to look for an availableprops.src.blurDataURL
(statically imported images) orprops.blurDataURL
(markdown images); if available, setplaceholder="blur"
elseplaceholder="empty"
Other updates
getPlaiceholder
async function during the build process, which resulted in failed/timed-out builds during dev/testing.Preview URL
Related Issue
https://www.notion.so/efdn/Blurred-images-placeholder-49351ac3288e4dad90c244b3e6365ba7?pvs=4