Skip to content
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

Merged
merged 17 commits into from Apr 28, 2017
Merged

Add Facebook like button support: amp-facebook-like #8989

merged 17 commits into from Apr 28, 2017

Conversation

eduardogoncalves
Copy link
Member

Since AMP already loads facebook sdk, why not have an like-button extension?

@googlebot
Copy link

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!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@eduardogoncalves
Copy link
Member Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

this.applyFillContent(iframe);
// Triggered by context.updateDimensions() inside the iframe.
listenFor(iframe, 'embed-size', data => {
this./*OK*/changeHeight(data.height);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#attemptChangeHeight, please.

Copy link
Member Author

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.

Copy link
Contributor

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 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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 @@
<!---
Copy link
Contributor

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');
Copy link
Contributor

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.

Copy link
Member Author

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>
Copy link

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.
Copy link

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.
Copy link

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.
Copy link

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.
Copy link

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.
Copy link

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__
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs look good.

Copy link
Contributor

@honeybadgerdontcare honeybadgerdontcare left a 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"
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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 @@
#
Copy link
Contributor

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.
Copy link
Contributor

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"
Copy link
Contributor

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>
Copy link
Contributor

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
Copy link
Contributor

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

@aghassemi aghassemi merged commit 9a1bfaf into ampproject:master Apr 28, 2017
@aghassemi
Copy link
Contributor

@eduardogoncalves Thanks for contributing!

@aghassemi
Copy link
Contributor

/cc @sebastianbenz new amp-facebook-like component

@eduardogoncalves
Copy link
Member Author

Ty I'm pleased to help.

KenneyE pushed a commit to spotxchange/amphtml that referenced this pull request May 3, 2017
@eduardogoncalves
Copy link
Member Author

Hi, how does it works now? I tried to run facebook.amp.html example, but it says: Failed to load resource: the server responded with a status of 404 (): https://cdn.ampproject.org/v0/amp-facebook-like-0.1.js

@honeybadgerdontcare
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants