-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
✨ implement amp-embedly-card component #14819
✨ implement amp-embedly-card component #14819
Conversation
51f871c
to
d298d76
Compare
@aghassemi @alanorozco New PR ready for review 😁 |
25ed7e1
to
e3cac88
Compare
Thanks @juanlizarazo. I will defer the full review to @alanorozco On the API side: Is there a particular reason |
It was a change requested on the original But maybe it made more sense then as it was required. For the new I'll be happy to remove the additional |
@juanlizarazo I see. I don't have a strong opinion, leaving the final decision to @alanorozco on this. |
e3cac88
to
bc2be81
Compare
@@ -0,0 +1 @@ | |||
PASS |
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 you're submitting validator rules, could you please follow the steps described here to generate test cases?
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.
Updated!
|
||
/** @override */ | ||
layoutCallback() { | ||
return getEmbedlyServiceForDoc(this.element).then(service => { |
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.
I know I originally suggested a service, but there's be a better way.
- Remove the service
- Simply query for
document.querySelector('amp-embedly-key').getAttribute('data-key');
The service suggestion was way overdesigned, I apologize.
I also read the other thread regarding the API. Unless you have an objection and after this change, it looks good to me!
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.
Thanks Alan, I will be updating this PR tonight :D
Keeping this PR open since there is progress. |
bc2be81
to
efa154d
Compare
Updated as requested:
|
``` | ||
|
||
Setting a key through the `amp-embedly-key` component is optional. If you are a paid user | ||
this will remove Embedly's branding from the cards. |
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.
This tag must only be included once
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.
Updated
} | ||
} | ||
|
||
tags: { # <amp-embedly-key> |
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.
Add unique: 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.
Added
requires_extension: "amp-embedly-card" | ||
attrs: { | ||
name: "data-url" | ||
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.
You may want to consider adding some restrictions on the url. e.g. https
only. See the UrlSpec for what can be restricted. It can be set as a value_url
on the tags spec, e.g.
value_url: {
allowed_protocol: "https"
allow_relative: false
}
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.
Added!
tags: { # <amp-embedly-card> | ||
html_format: AMP | ||
tag_name: "AMP-EMBEDLY-CARD" | ||
satisfies: "amp-embedly-card" |
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.
This isn't needed (satisfies
)
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.
Removed
@@ -0,0 +1,69 @@ | |||
<!doctype html> |
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.
This should probably be in extensions/amp-embedly-card/0.1/tests/
as validator-amp-embedly-card.html
and the .out
file as well.
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.
Moved to recommended folder and renamed.
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.
Updated with recommended changes.
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.
This is awesome, really clean and thorough.
@bpaduch For assistance with docs. |
Awesome, thanks! @alanorozco @bpaduch @aghassemi For the examples page in As keys are paid, that key eventually will be eventually invalid. |
Sure, removing the key sounds good. |
</tr> | ||
<tr> | ||
<td width="40%"><strong>Required Script</strong></td> | ||
<td><code><script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-embedly-card-0.1.js"></script></code></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.
Change "amp-form" to "amp-embedly-card"
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.
Updated
<table> | ||
<tr> | ||
<td width="40%"><strong>Description</strong></td> | ||
<td>Provides you with responsive and shareable embeds to drive the reach of your websites, blog posts, and articles. from any URL using <a href="http://docs.embed.ly/docs/cards">Embedly cards</a>.</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 period after articles
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.
Removed
*Example: Embedding multiple resources* | ||
|
||
If you have a paid plan, use the `amp-embedly-key` component to set your api key. | ||
You just need one per document that includes one or multiple `amp-embedly-card` components: |
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.
need "one" what? If it's amp-embedly-key
, please specify that.
Like:
You just need one amp-embedly-key
per AMP page.
Within the AMP page, you can specify one or multiple amp-embedly-card
components:
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.
Updated.
*Example: Embedding multiple resources* | ||
|
||
If you have a paid plan, use the `amp-embedly-key` component to set your api key. | ||
You just need one per AMP page. |
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.
Clarify what you mean by "one". For example "You just need one amp-embedly-key
per AMP page.
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.
Updated.
</amp-embedly-key> | ||
``` | ||
|
||
Setting a key through the `amp-embedly-key` component is optional. If you are a paid user, this removes Embedly's branding from the cards. |
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.
Would this be clearer:
If you are a paid user, setting the amp-embedly-key
removes Embedly's branding from the cards.
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.
Definitively, updated.
|
||
##### data-card-theme | ||
|
||
For dark backgrounds it's better to specify the dark theme. |
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.
What are the possible values for this attribute. Should also state what this attribute does, which is "Sets the card theme." then tell them what the default is, and possible values.
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.
Updated with possible values and default and more info on this attribute.
|
||
##### data-card-image | ||
|
||
Specifies which image to use in article cards. |
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.
What should the value be - a URL, something else? Please advise.
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.
Added more info.
|
||
##### data-card-controls | ||
|
||
Enables share icons. The default value is `1`. |
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.
Clarify that by default share icons are enabled. To turn them off, specify '0'.?
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.
Updated to explain these better.
|
||
##### data-card-align | ||
|
||
Aligns the card. The default value is `"center"`. |
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.
What are the other values - please specify.
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.
Added possible values.
|
||
##### data-card-recommend | ||
|
||
Disables Embedly recommendations on video and rich cards. The default value is `1`. |
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.
Indicate that by default, recommendations are disabled (assuming "1" means that).
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.
Updated
7260c9f
to
e613e6b
Compare
Codecov Report
@@ Coverage Diff @@
## master #14819 +/- ##
==========================================
- Coverage 77.61% 77.58% -0.04%
==========================================
Files 553 557 +4
Lines 40337 40392 +55
==========================================
+ Hits 31309 31339 +30
- Misses 9028 9053 +25
Continue to review full report at Codecov.
|
@bpaduch Updated with requested changes! |
amp-embedly-card: uses requires extensio amp-embedly-card: Update amp-embedly-key validation rules
ed97fc4
to
265be3c
Compare
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 LGTM
Yay! Thanks @juanlizarazo 🎉 |
@juanlizarazo This is in Dev Channel right now (If you enabled Dev Channel in https://cdn.ampproject.org/experiments.html you can give it a try). Will make it to production over the next couple of days. |
Just tried it with different embeds. Can't wait! |
@aghassemi — the documentation should really mentioned that data-url (required) only accepts https protocol, otherwise your page won't validate. |
@gctommy @aghassemi I can create a PR fixing that, I made sure the examples were compliant but I spaced out with the docs. I will fix a typo as well I saw there too and possibly remove the data-via property as well. I talked to embedly support about it and the sdk doesn't do what it is supposed to. So right now using |
PR that implements
amp-embedly-card
component (feature request #12908) using embedly cards.