iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article

X (Twitter) doesn't seem to render OGP (Twitter Cards) for HTML over 2MB

に公開1

I was troubled because the OGP wouldn't expand as a Twitter Card when I posted the URL of this site I created to X.

https://mingeiinter.net/

It was expanding correctly when I checked the post preview a little while ago, so why...?
The only thing I can think of is that the page size has increased since then because I added more data...

Curious about this, I decided to test it by keeping the OGP content exactly the same and only changing the size of the text within the <body>.

In the Case of Large HTML

It doesn't appear.

As I tried decreasing the file size little by little starting from 3MB...

In the Case of HTML Under 2MB

It appeared!

Summary

While X's documentation does not explicitly mention a specific file size limit, there is reportedly a 3MB limit for images used as og:image, so it is likely that a limit also exists for the HTML size of the shared page.
Although I only verified based on file size this time, factors like DOM depth or other elements might have an influence, so 2MB should be considered a rough guide.

By the way, on Zenn, Facebook, and Threads, the OGP was expanded without any issues even when the HTML size was around 3MB.

Discussion