-
Notifications
You must be signed in to change notification settings - Fork 384
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
The amp-timeago is getting stripped out #2067
Comments
@pradeep910 It seems you are missing the required Is the |
The AMP validation error regarding the |
When I test, the following code with corrected add_action(
'wp_footer',
function () {
?>
<p>
<amp-timeago class="gk-date-diff" datetime="2019-03-21T06:07:16Z" cutoff="2592000" height="40">March 21, 2019, 6:07 AM</amp-timeago>
</p>
<?php
}
); I then see the |
@westonruter Thank you very much for letting me know the actual issue. I wanted to check with you first because we used We are adding script for Non-AMP manually. It worked fine on Non-AMP pages, so I thought it will work on AMP pages also. But as you pointed out, seems like there's very strict check for AMP validation. |
@pradeep910 as long as the To prevent causing a secondary validation error when the actual add_function( 'wp_enqueue_scripts', function() {
if ( ! is_amp_endpoint() ) {
wp_enqueue_script( 'amp-timeago' );
}
} ); Note that this use of AMP components outside of AMP pages it not officially supported yet. However, support is coming and you can track that in ampproject/amphtml#15583. |
amp-timeago
doesn't work outside content.When we use
amp-timeago
component insidethe_content
/ gutenberg, AMP plugin doesn't stripamp-timeago
, it works fine, but when we use it outside content, it's stripping out the tag and giving this AMP validation error.Here is the tag that we are using in code -
<amp-timeago class="gk-date-diff" datetime="2019-03-21 06:07:16" cutoff="2592000">March 21, 2019, 6:07 AM</amp-timeago>
I see that amp-timeago is allowed tag in the specs -
https://github.com/ampproject/amp-wp/blob/develop/includes/sanitizers/class-amp-allowed-tags-generated.php#L5000-L5034
@westonruter
I tried disabling
remove_node()
and then it retained the amp-timeago tag. So looks like something is wrong withcheck_attr_spec_rule_value_regex
or is it stripping it out purposely? - https://github.com/ampproject/amp-wp/blob/develop/includes/sanitizers/class-amp-tag-and-attribute-sanitizer.php#L1974The text was updated successfully, but these errors were encountered: