Open JanDW opened 4 years ago
Paste of my bearnotes
Responsive images - Learn web development | MDN
Pass the access key in a request header:
⚠️ access key should not be shared or put on website!
Authorization: Client-ID {public key}
Read more: Public Authentication. Access the public as well as the secret key at Unspash | wild peaches
Netlify Environment Variables: The Cheat Codes of the Internet ― Scotch.io
srcset
in a JSON file in my _data
folder as it will be available as a global data collection and use that in the requests for image sizes. Maybe? Possible change image url and add query params? Perhaps use some JS to provide the following data in the query params?
URLSearchParams - Web APIs | MDN
window.devicePixelRatio
document.querySelector('html’).clientWidth
Deprioritizing for now. If proceeding create separate layout that can be swapped out in the front matter. Also allow for images other than unsplash.
I'm experimenting with adding hero images to the blogposts.
I figured unsplash.com would be the best source of images, so I started thinking about integrating with it. I want to specify the image ID in the blog post's front matter. When Eleventy builds the site it should look up the image on unsplash API
GET /photos/:id
srcset
in the rendered HTML<img alt="">
attributeOf course, the image will always be the same, so I don't want Eleventy to call the API for each and every build. To that end, I'm using @11ty/eleventy-cache-assets to cache the API calls.