简体   繁体   English

Drupal 8生成所有样式的所有图像

[英]Drupal 8 Generate all images for all styles

I'm working on a Drupal 8.6 multi site installation, where every site has it's own database, and I'm having a problem where the first time a content is shared on Facebook it uses the wrong image. 我正在进行Drupal 8.6多站点安装,其中每个站点都有自己的数据库,我遇到的问题是,第一次在Facebook上共享内容时,它会使用错误的图像。

The meta tag is configured right, it is something like this: 元标记配置正确,它是这样的:

<meta property="og:image" content="https://xxxx.com/image.jpg?itok=w8tMeCC0" />

This image problem happens only at the first share and I believe it happens because the image has not been created yet at the moment of the first share. 此图像问题仅在第一次共享时发生,我相信它发生的原因是在第一次共享时尚未创建图像。

I would like to know what I could do to force the image to be generated as soon as the content is published and if there is a way to create all the missing images. 我想知道如何在内容发布时强制生成图像,以及是否有办法创建所有丢失的图像。

I found this post and I'm trying to implement in a module (I never worked on Drupal before) but I don't even know how to schedule this piece of script to be executed. 我找到了这篇文章 ,我试图在一个模块中实现(我之前从未使用过Drupal),但我甚至不知道如何安排这段脚本执行。

Is there an existing module or setting that does that? 是否有现有的模块或设置?

Thanks for any help! 谢谢你的帮助!

Have you tried the facebook Debugger? 您是否尝试过Facebook Debugger? https://developers.facebook.com/tools/debug/ Facebook usually stores the metatags in cache during shares. https://developers.facebook.com/tools/debug/ Facebook通常在共享期间将元标记存储在缓存中。 What I usually do is debug the webpage at least once with the right metatags configured in the debugger and ensure the page loads correctly there. 我通常做的是使用调试器中配置的正确元标签至少调试一次网页,并确保页面正确加载。 Afterwards, the share will be loading all the assets correctly. 之后,共享将正确加载所有资产。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM