Google AMP amp-facebook-like
Introduction: A really popular featured in web pages are like button from social media platforms. The amp-facebook-like is used to embed a Facebook like button to an AMP HTML page. Here when a Facebook like button is embedded you can like the post without going to Facebook itself.
Required Script: Add the following script containing source to importing the amp-facebook-like component.
HTML
< script async custom-element = "amp-facebook-like" src = </ script > |
chevron_right
filter_none
Attributes:
- data-href: URL of the page to be liked.
- data-action: String to be displayed on button. Default value is “Like”.
- data-colorscheme: Color scheme that should be used outside the button. By default, it is light and it can be kept as dark also.
- data-size: It is used to change the size of the button. By default, it is small and it can be set to large also.
- data-layout : It is used to change the layout of the button. There are four layouts available and these are:
- standard (Default)
- button
- button_count
- box_count
Example:
HTML
<!doctype html> < html amp> < head > < meta charset = "utf-8" > < title >amp-facebook-like</ title > < script async src = </ script > <!-- Import the `amp-facebook-like` component to add a like button--> < script async custom-element = "amp-facebook-like" src = </ script > < link rel = "canonical" href = < meta name = "viewport" content = "width=device-width,minimum-scale=1,initial-scale=1" > < style amp-boilerplate> body { -webkit-animation: -amp-start 8s steps(1, end) 0s 1 normal both; -moz-animation: -amp-start 8s steps(1, end) 0s 1 normal both; -ms-animation: -amp-start 8s steps(1, end) 0s 1 normal both; animation: -amp-start 8s steps(1, end) 0s 1 normal both } @-webkit-keyframes -amp-start { from { visibility: hidden } to { visibility: visible } } @-moz-keyframes -amp-start { from { visibility: hidden } to { visibility: visible } } @-ms-keyframes -amp-start { from { visibility: hidden } to { visibility: visible } } @-o-keyframes -amp-start { from { visibility: hidden } to { visibility: visible } } @keyframes -amp-start { from { visibility: hidden } to { visibility: visible } } </ style > < noscript > < style amp-boilerplate> body { -webkit-animation: none; -moz-animation: none; -ms-animation: none; animation: none } </ style > </ noscript > </ head > < body > < amp-facebook-like width = "100" height = "30" layout = "fixed" data-layout = "button_count" data-href = </ amp-facebook-like > </ body > </ html > |
chevron_right
filter_none