OpenGraph 图像
Feed this runtime service a URL and it will extract an optimized OpenGraph image using these sources:
<meta name="og:image:secure_url"><meta name="og:image"><meta property="og:image">
Open Source
Usage
Try it out on the Eleventy API Explorer.
Image URLs have the format:
https://opengraph.w3c.cool/:url/
https://opengraph.w3c.cool/:url/:size/
https://opengraph.w3c.cool/:url/:size/:format/
urlmust be URI encoded.size(optional) can besmall(375×),medium(650×), orauto(keep original width)formatmust by an output image format supported by Eleventy Image
Samples
<img
src="https://opengraph.w3c.cool/https%3A%2F%2Fblog.w3c.cool%2F/small/"
alt="OpenGraph image for blog.w3c.cool"
loading="lazy"
decoding="async"
width="375"
height="197"
/>
<img
src="https://opengraph.w3c.cool/https%3A%2F%2Fwww.a11yproject.com%2F/small/"
alt="OpenGraph image for a11yproject.com"
loading="lazy"
decoding="async"
width="375"
height="197"
/>
<img
src="https://opengraph.w3c.cool/https%3A%2F%2Fwww.netlify.com%2F/small/"
alt="OpenGraph image for netlify.com"
loading="lazy"
decoding="async"
width="375"
height="197"
/>
