Prejsť na hlavný obsah
← 📄 HTML & the platform·Modul A6 · Lekcia 6
ÚlohaAdd Twitter card tags to a post: twitter:card 'summary_large_image', twitter:site '@codementor', twitter:image 'https://example.com/og.png', twitter:image:alt 'Article hero image'.

Twitter karty (X kariet)

75 XP6 min
Teória

X (formerly Twitter) reads OG too — but adds its own tags

The site rebranded to "X" in 2023 but every meta tag still uses the literal string twitter:*. The card preview hasn't changed; only the company name did.

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@codementor_ai" />
<meta name="twitter:creator" content="@anna_dev" />
<meta name="twitter:image" content="https://example.com/og.png" />
<meta name="twitter:image:alt" content="A product logo" />

twitter:card — the only one that ALWAYS matters

summary              → small thumbnail beside text
summary_large_image  → big image on top, text below
player               → video / audio player
app                  → install card with App Store badge

summary_large_image is what you almost always want — visually it's the biggest, most engaging unfurl. Without this tag explicitly set, Twitter falls back to summary (small thumbnail).

twitter:site vs twitter:creator

  • twitter:site — your brand's handle (@codementor_ai).
  • twitter:creator — the article author's handle (@anna_dev).

Both optional. twitter:site is the more important one — it links your brand into the share card.

When you can skip Twitter tags entirely

If you have a full set of OG tags + twitter:card="summary_large_image", Twitter renders perfectly. Some teams ship just that one Twitter tag and let everything else fall through to OG.

The image rule

Twitter wants a 2:1 aspect ratio (1200 × 600 or 1600 × 800) for summary_large_image. The 1200×630 OG image works fine — Twitter crops the top/bottom 15px (you won't notice).

🔒

Zaregistruj sa a začni programovať

Teória je otvorená pre každého. Editor, živý náhľad a kontrola sa odomknú so 7-dňovou bezplatnou skúškou — karta potrebná, zruš kedykoľvek.

Registrácia — bezplatná skúška →

Prvých 10 lekcií v každej trase je zdarma. Karta nie je potrebná.

← PredchádzajúcaĎalšia lekcia →

Jeden tip k Pythonu alebo webu denne — e-mailom

Krátke, ručne písané, žiadny spam. Odhlásiť jedným klikom.