New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Facebook like button support: amp-facebook-like #8989
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
this.applyFillContent(iframe); | ||
// Triggered by context.updateDimensions() inside the iframe. | ||
listenFor(iframe, 'embed-size', data => { | ||
this./*OK*/changeHeight(data.height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#attemptChangeHeight
, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jridgewell, sorry, I didn't undestand.
#attemptChangeHeight, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change changeHeight
to attemptChangeHeight
, which won't cause a reflow of content.
this.attemptChangeHeight(data.height).catch(() => { /* ignore failures */ });
@@ -0,0 +1,50 @@ | |||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jridgewell validation looks good, asked for some minor tweaks.
@@ -0,0 +1,94 @@ | |||
<!--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @bpaduch
gulpfile.js
Outdated
@@ -75,6 +75,7 @@ declareExtension('amp-dynamic-css-classes', '0.1', false, 'NO_TYPE_CHECK'); | |||
declareExtension('amp-experiment', '0.1', false, 'NO_TYPE_CHECK'); | |||
declareExtension('amp-facebook', '0.1', false); | |||
declareExtension('amp-facebook-comments', '0.1', false); | |||
declareExtension('amp-facebook-like', '0.1', false, 'NO_TYPE_CHECK'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to remove the NO_CHECK_TYPE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
removed 'no_type_check' as
<table> | ||
<tr> | ||
<td width="40%"><strong>Description</strong></td> | ||
<td>Embeds the Facebook like-button plugin.</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the hyphen
The verb to display on the button. Can be either like or recommend. | ||
|
||
**data-colorscheme** (optional) | ||
The color scheme used by the plugin for any text outside of the button itself. Can be light or dark. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please insert a blank line in between the attribute and description for all attributes that don't have a blank line in between.
Specifies whether to display profile photos below the button (standard layout only). You must not enable this on child-directed sites. | ||
|
||
**data-size** (optional) | ||
The button is offered in 2 sizes i.e. large and small. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrite as:
The size of the button, which can be one of two sizes, large
or small
. The default is small
.
|
||
**data-action** (optional) | ||
|
||
The verb to display on the button. Can be either like or recommend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put the values in code style: like
or recommend
.
The verb to display on the button. Can be either like or recommend. | ||
|
||
**data-colorscheme** (optional) | ||
The color scheme used by the plugin for any text outside of the button itself. Can be light or dark. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put the values in code style: light
or dark
If your web site or online service, or a portion of your service, is directed to children under 13 you must enable this | ||
|
||
**data-layout** (optional) | ||
Selects one of the different layouts that are available for the plugin. Can be one of standard, button_count, button or box_count. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put values in code style.
Applied markdown tags, removed `data-` elements with default values from __Example__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs look good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for doing a great job with the validation!
mandatory: true | ||
} | ||
attr_lists: "extended-amp-global" | ||
spec_url: "https://www.ampproject.org/docs/reference/components/social/amp-facebook-like" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec_url is changing again and it's no longer necessary to specify a sub-component. So let's remove social
from the URL. It will be this instead:
spec_url: "https://www.ampproject.org/docs/reference/components/amp-facebook-like"
@@ -0,0 +1,50 @@ | |||
# | |||
# Copyright 2016 The AMP HTML Authors. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit s/2016/2017.
# data-* is generally allowed, but it's not generally mandatory. | ||
attrs: { | ||
name: "data-href" | ||
mandatory: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is an href let's enforce some restrictions on it's values.
value_url: {
allowed_protocol: "https"
allow_relative: false
}
@@ -0,0 +1,50 @@ | |||
# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jridgewell validation looks good, asked for some minor tweaks.
@@ -0,0 +1,73 @@ | |||
/** | |||
* Copyright 2015 The AMP HTML Authors. All Rights Reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2017 ( and in other files as well)
tags: { # <amp-facebook-like> | ||
html_format: AMP | ||
tag_name: "AMP-FACEBOOK-LIKE" | ||
disallowed_ancestor: "AMP-SIDEBAR" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't see a need to disallow this in sidebar. Actually sidebar is a good place for a like button. @camelburrito ?
</tr> | ||
<tr> | ||
<td width="40%"><strong>Availability</strong></td> | ||
<td>Stable</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to "In Development" and change to "Stable" 3 weeks after PR is merged (when validator changes are in production)
<script async custom-element="amp-facebook-like" src="https://cdn.ampproject.org/v0/amp-facebook-like-0.1.js"></script> | ||
</head> | ||
<body> | ||
<amp-facebook-like width=120 height=30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add sample usage to examples/facebook.amp.html
Change changeHeight to attemptChangeHeight (which won't cause a reflow of content) as request by jridgewell
@eduardogoncalves Thanks for contributing! |
/cc @sebastianbenz new |
Ty I'm pleased to help. |
Hi, how does it works now? I tried to run facebook.amp.html example, but it says: |
@eduardogoncalves It looks like your component is still in pre-release. Also it takes two to three week for validation changes to make it into production. So even if the component was released, it wouldn't be valid yet. Hopefully in the coming week or two it'll be ready for use in production. |
Since AMP already loads facebook sdk, why not have an like-button extension?