October 2017
Intermediate to advanced
370 pages
8h 57m
English
By default, the amp-social-share component will pull out the site URL from the rel=canonical link. In many cases, you can also configure the shared URL and message, depending on the social media service, by setting values for data-param-* attributes. The most common are data-param-url, which generally defaults to the canonical page URL, and data-param-text, which defaults to the current page title.
For example, you could configure the Twitter share to link to a specific product page, and to include the text Check out this awesome t-shirt, with the following code:
<amp-social-share type="twitter" data-param-url="https://theampbook.com/ch5/product.html" data-param-text="Check out this awesome tshirt. Only worn once!" ...
Read now
Unlock full access