跳转到导航 跳转到主要内容
CNB版本
社区版
cnb.cool
国外版
cnb.build
2025/12/30

OpenGraph 图像

本页大纲

Feed this runtime service a URL and it will extract an optimized OpenGraph image using these sources:

  1. <meta name="og:image:secure_url">
  2. <meta name="og:image">
  3. <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/
  • url must be URI encoded.
  • size (optional) can be small (375×), medium (650×), or auto (keep original width)
  • format must by an output image format supported by Eleventy Image

Samples

OpenGraph image for blog.w3c.cool
<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"
/>
OpenGraph image for a11yproject.com
<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"
/>
OpenGraph image for netlify.com
<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"
/>

其他页面在 Runtime APIs