Skip to main content

Yoast SEO Twitter Tags: Functional specification

This documentation provides technical information about which twitter tags Yoast SEO generates and outputs. These tags are only consumed by Twitter.

We output a variety of <meta> tags for Twitter in the <head> of each page, in order to better inform Twitter about the content of the page in question.

Note that for a lot of tags, Twitter falls back on OpenGraph metadata. Where it falls back, we provide the OpenGraph metadata and don't provide the Twitter tag specifically unless it has been customized.

Twitter metadata

The following tags provide social networks and platforms (e.g., Facebook, Twitter, Pinterest) with additional information about the page and its content.

Assuming that the respective admin settings are not disabled, these tags are output on all pages (except for error templates, which are described separately).

TagDescription
twitter:cardThe card type to use when previewing the page (defaulting to summary_large_image).
twitter:siteThe twitter handle of the site owner/operator.

Conditional tags

The following tags are only output when their conditions are met:

TagDescriptionNotes
twitter:creatorThe twitter handle of the content author.Only populated when the content author has a valid Twitter handle.
Only populated on post types.
twitter:titleThe title of the page, specifically for sharing on Twitter.Only populated when a specific value (which is different from the og:title value) is defined for Twitter.
twitter:descriptionThe description of the page, specifically for sharing on Twitter.Only populated when a specific value (different from the og:description value) is defined for Twitter.

The hierarchy for this is as follows:
  • A user-defined "Twitter description" value for the page.
  • An auto-generated "Social description" from the template in Search Appearance.
  • No output, i.e. falls back on og:description.
twitter:imageThe URL of the primary image of the page, specifically for sharing on Twitter.Only populated when a specific image (different from the og:image) is defined for Twitter, or, when Facebook / og:image tags are disabled.

  • A user-defined “Twitter image” in the Social tab of the Yoast metabox in a twitter:image tag
  • A user-defined “Facebook image” in the Social tab of the Yoast metabox in an og:image tag
  • A user-defined “Featured image” for the page (in an og:image tag, or in a twitter:image tag if Open Graph is disabled)
  • A prominent image from the page’s content. (in an og:image tag, or in a twitter:image tag if Open Graph is disabled)
  • Yoast SEO WooCommerce only: Woo SEO adds one more image fallback: the first image in the Woo Product gallery. (in an og:image tag, or in a twitter:image tag if Open Graph is disabled)
  • The “Social default image” from the template in Search Appearance in an og:image tag
  • The site-wide Social default image from SEO > Social in an og:image tag
  • No output.
In case of an author archive, the image is based on the following hierarchy:
  • The “Social default image” from the template in Search Appearance in an og:image tag
  • The user’s Gravatar image (in an og:image tag, or in a twitter:image tag if Open Graph is disabled)
  • No output, i.e. falls back to og:image.

"Enhanced Slack sharing" tags

We utilize Twitter's "label/data" meta tag format to add additional data, which is shown when sharing URLs on Slack. Note that this should only be output if the "Enhanced Slack sharing" setting is enabled for the site.

TagDescriptionNotes
<meta name="twitter:label1" content="Est. reading time" />Only output on post and page types.
<meta name="twitter:data1" content="%x% minutes" />Where %x% is the estimated reading time, rounded down to the closest minute.