Oh, thanks! Is it possible to do that without actually allowing Twitter logins?
Disable enable twitter logins and just provide twitter consumer key & twitter consumer secret.
Tried it. It didn’t work. Embedded tweets still do not contain images.
Some long tweets with images don’t work
Shorter tweets with images works
It exists since the new twitter policy regarding links and images in the 140 characters count
I’ve just submitted a PR which should fix this:
@david - thank you! We do a lot of Twitter oneboxing and found the truncation very annoying.
This is terrific - my forum users really need this.
Is this merged into a future release or something we have to do to modify in our existing installations?
Just upgrade on latest version, it should be good :
- via
yourforum.com/admin/upgrade - or SSH into your server and do these commands :
cd /var/discourse
git pull
./launcher rebuild app
I don’t think you need to add the twitter consumer key and twitter consumer secret in your admin settings but I’m only 99% sure
Yep - it’s all merged into master and working great on my forum
I’m afraid you will need to add these keys to your site settings - the data is fetched via the twitter API rather than opengraph/oembed.
It’s always the 1% left 
I just pushed a small improvement for Twitter onebox. The onebox will now show like and retweet count.
@awesomerobot 有没有一个简单的 CSS 修复方案来解决
的问题?
目前,在移动端我们设置了最大高度(70vh)和 100% 宽度,视频会自适应缩放。这种方式对竖屏视频的效果优于横屏视频。
我们可以假设大多数视频为横屏,但作为权衡,我们会对竖屏视频进行较为严重的裁剪。
在不了解宽高比的情况下,没有简单的方案能同时解决这两个问题(我们能否计算这些视频的宽高比,并据此附加相应的样式?iframe 似乎自带高度和宽度属性)。
是的,我们可以做到。这是我们构建 iframe 的那一行代码:
@awesomerobot,什么样的 HTML 结构对您最有用?例如:
<div class='tweet-images'>
<div class='aspect-image-full-size' style='--aspect-ratio:#{width}/#{height};'/>
<iframe class='tweet-video' src='https://twitter.com/i/videos/blah' width='123' height='456' frameborder='0' allowfullscreen></iframe>
</div>
</div>
然后我们可以复用用于图片的 aspect-image-full-size 逻辑,对吗?
是的,我认为这样可以,有了那个宽高比,我应该能根据需要调整。
我想知道如何将通过 Zapier 获取的推文以这种方式显示为话题,但遇到了困难。有人能指点一下方向吗?是否只需在设置中启用“onebox”即可?
是否有任何方法可以让嵌入的推文显示被回复的推文?例如,如果我嵌入这条推文 https://twitter.com/AOC/status/1230329539924025345,在 phpBB 和 vBulletin 中会同时显示该推文和她回复的内容。
phpBB:
vB:
但在 Discourse 中只显示回复内容,如果没有原始推文的上下文,这往往让人难以理解。
当然,同时发布原始推文和回复内容并不难,但大多数用户(以及我们使用的几个 Twitter 机器人)并不够聪明或细心,无法意识到需要这样做。
这是一个非常棘手的问题,Twitter 官方的嵌入代码存在两个问题:
- 它不提供高度信息,导致内容加载时页面布局会跳动。
- 我们需要在所有网站上运行 Twitter 的 JavaScript 文件。
我们通过使用自定义渲染器来规避这些问题,但不幸的是,这意味着我们需要不断跟进官方嵌入代码的更新。


