Skip to content

Add link preview cards to the new-tweet composer #1336

Description

@AlexMnrs

Feature request

Add a link preview card to the new-tweet composer when a user pastes or types a URL.

Motivation

At the moment, the composer displays the URL as text only. This makes it difficult to know how the link will appear after publishing and is a noticeable difference from the regular X experience.

OldTwitter already renders link cards on published tweets, including summary and summary_large_image cards with a thumbnail, title, description, and destination URL. However, the new-tweet composer does not currently show a preview while the tweet is being written.

Proposed scope

  • Detect a URL in the new-tweet composer.
  • Show a preview card with the available domain, title, description, and thumbnail.
  • Update or remove the preview when the URL changes or is removed.
  • Reuse the existing card rendering where practical.
  • When publishing, use the card mechanism supported by X if the required metadata or card URI is available.

The implementation should not require arbitrary client-side fetching of third-party pages if that would introduce CORS, privacy, or security problems. It would be useful to first confirm which response/API path X currently uses to generate or associate a card for a URL.

Current implementation notes

  • The composer is implemented in layouts/home/script.js.
  • Existing published-tweet card rendering is handled by generateCard in scripts/helpers.js.
  • scripts/apis.js already handles card_uri, while the composer currently uses that path for polls rather than ordinary URL previews.

This request is intentionally limited to link previews in the new-tweet composer; video previews, media-tab changes, and other composer improvements should be tracked separately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions