Do you build things with AMP? Fill out the AMP Developer Survey!

Important: this documentation is not applicable to your currently selected format ads!




Required Scripts

<script async custom-element="amp-social-share" src=""></script>


The amp-social-share component displays a social share button for social platforms.

Currently, none of the buttons generated by amp-social-share (including those for the pre-configured providers) have a label/accessible name that is exposed to assistive technologies (such as screen readers). Make sure to include an aria-label with a descriptive label, as otherwise these controls will just be announced as unlabelled "button" elements.

Example: Basic social share button

The share button guesses some defaults for you for some pre-configured providers. It assumes that the current document canonical url is the URL you want to share and the page title is the text you want to share.

  aria-label="Share on Twitter"

Example: Passing parameters

When you want to pass parameters to the share endpoint, you can specify data-param-<attribute> that will be appended to the share endpoint.

  data-param-text="Hello world"
  aria-label="Share on LinkedIn"

Linkedin is one of the pre-configured providers, so you do not need to provide the data-share-endpoint attribute.

Pre-configured providers

The amp-social-share component provides some pre-configured providers that know their sharing endpoints as well as some default parameters.

Provider Type Parameters
Web Share API (triggers OS share dialog) system
  • data-param-text: optional, defaults to: "Current page title"
  • data-mode: optional, if set to replace, all other share options are removed.
Email email
  • data-param-subject: optional, defaults to: Current page title
  • data-param-body: optional, defaults to: rel=canonical URL
  • data-param-recipient: optional, defaults to: '' (empty string)
Facebook facebook
  • data-param-app_id: required, defaults to: none. This parameter is the Facebook app_id that's required for the Facebook Share dialog.
  • data-param-href: optional, defaults to: rel=canonical URL
  • data-param-quote: optional. Can be used to share a quote or text.
LinkedIn linkedin
  • data-param-url: optional, defaults to: rel=canonical URL
Pinterest pinterest
  • data-param-media: optional (but highly recommended to be set), defaults to: none. Url for the media to be shared on Pinterest. If not set, the end user will be requested to upload a media by Pinterest.
  • data-param-url: optional, defaults to: rel=canonical URL
  • data-param-description: optional, defaults to: Current page title
Tumblr tumblr
  • data-param-url: optional, defaults to: rel=canonical URL
  • data-param-text: optional, defaults to: Current page title
Twitter twitter
  • data-param-url: optional, defaults to: rel=canonical URL
  • data-param-text: optional, defaults to: Current page title
Whatsapp whatsapp
  • data-param-text: optional, defaults to: "Current page title - current page URL"
LINE line
  • data-param-url: optional, defaults to: rel=canonical URL
  • data-param-text: optional, defaults to: Current page title
SMS sms
  • data-param-body: optional, defaults to: rel=title - rel=canonical URL

Non-configured providers

In addition to pre-configured providers, you can use non-configured providers by specifying additional attributes in the amp-social-share component.

Example: Creating a share button for a non-configured provider

The following example creates a share button through Facebook Messenger by setting the data-share-endpoint attribute to the correct endpoint for the Facebook Messenger custom protocol.

  data-param-text="Check out this article: TITLE - CANONICAL_URL"
  aria-label="Share on Facebook Messenger"

As these providers are not pre-configured, you'll need to create the appropriate button image and styles for the provider.

Variable Substitution

You can use global AMP variables substitution in the <amp-social-share> element. In the example below, TITLE is substituted with the page title and CANONICAL_URL with the document's canonical URL.

  data-param-text="Check out this article: TITLE - CANONICAL_URL"


type (required)

Selects a provider type. This is required for both pre-configured and non-configured providers.


Specifies the target in which to open the target. The default is _blank for all cases other than email/SMS on iOS, in which case the target is set to _top.

Please note that we only suggest using this override for email.


This attribute is required for non-configured providers.

Some popular providers have pre-configured share endpoints. For details, see the Pre-configured Providers section. For non-configured providers, you'll need to specify the share endpoint.


All data-param-* prefixed attributes are turned into URL parameters and passed to the share endpoint.


Default Styles

By default, amp-social-share includes some popular pre-configured providers. Buttons for these providers are styled with the provider's official color and logo. The default width is 60px, and the default height is 44px.

Visit AMP Start for responsive, pre-styled share links that you can use in your AMP pages.

Custom Styles

Sometimes you want to provide your own style. You can simply override the provided styles like the following:

amp-social-share[type='twitter'] {
  background: red;
  background-image: url(datauri:svg/myownsvgicon);

When customizing the style of an amp-social-share icon please ensure that the customized icon meets the branding guidelines set out by the provider (e.g Twitter, Facebook, etc.)


See amp-social-share rules in the AMP validator specification.

Benötigst du noch Hilfe?

Du hast dieses Dokument mehrmals gelesen, hast aber immer noch Fragen? Vielleicht hatten andere Nutzer das gleiche Problem: Schau doch bei Stack Overflow vorbei und lass dir von ihnen helfen.

Zu Stack Overflow wechseln
Möchtest du einen Bug oder ein fehlendes Feature melden?

Das AMP Projekt ist auf deine Teilnahme und deine Beiträge angewiesen! Wir hoffen natürlich, dass du dich aktiv an unserer Open Source Community beteiligen wirst. Aber wir freuen uns auch über einmalige Beiträge zu den Themen, die dich besonders interessieren.

Zu GitHub wechseln