|
|
|
|
|
by derekzhouzhen
1648 days ago
|
|
Very nice. og:image should be static, and I guess you render it once and cache the result on your site. I wish there is an easy way to download the rendered result and free you the burden of hosting the image. In other word, make it more like a og:image designer for free. You can charge money for the convenience of hosting the result. |
|
In JavaScript, for example, on a theoretical blog site, you could configure it like this:
const article = await fetchArticle(router.query.id);
const queryString = new URLSearchParams(article).toString();
const url = `https://cdn.ogimg.io/v1/u/your-name/blog?${queryString}`;
// add this in the <head> where appropriate...
<meta property="og:image" content="${url}" />
This will add nice pictures for all your articles at once based on your template.
I think I need to make this more clear!