Generating Open Graph Images in Eleventy在 Eleventy 中生成开放图图像
↑↑↑
I added the og:media image tags yesterday, and the approach seems to work, so I’m going to share it in this post.我昨天添加了 og:media 图像标签,这种方法似乎有效,所以我将在这篇文章中分享它。
I am using the filter functions and generating the raster images directly inside of the filter with node-canvas, as described in this article.我正在使用过滤器函数,并使用 node-canvas 直接在过滤器内生成光栅图像,如本文所述。
First I added the meta tags to my default layout. I called the filter previews, and I will be using the title variable as the argument.首先,我将元标记添加到我的默认布局中。我调用了筛选previews,我将使用 title 变量作为参数。
Then I wrote the filter.然后我写了过滤器。
This is the bare-bones set-up, without any decorations, or the name of the author, or anything like that, but this article and the node-canvas documentation describe how to add more things.这是最基本的设置,没有任何装饰,也没有作者的名字,或者类似的东西,但这篇文章和节点画布文档描述了如何添加更多的东西。