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
Block AMP on specific pages #709
Comments
We implemented something similar the other way around: we insert the interactive content via the Ad Inserter plugin on regular pages. The plugin allows you to blacklist (not load) the content for certain pages, in this case we black listed */amp/ for that content not to load on AMP pages. |
Great idea, however instead I do not want any AMP page at all to load. Not just the interactive content. |
@doodirock There is a filter you can use to disable AMP support for a given post. Let's say you add a custom field in postmeta called You can then add support for that custom postmeta by adding the following to your theme or plugin: add_filter( 'amp_skip_post', function( $skipped, $post_id ) {
if ( get_post_meta( $post_id, 'amp_skipped', true ) ) {
$skipped = true;
}
return $skipped;
}, 10, 2 ); So then the question remains for this issue as to whether there should be an actual UI in the AMP plugin to offer “Disable AMP paired mode”. There could be a checkbox in the publish metabox, for example, that offered this. |
There could be an interesting crossover with the AMP Validator here and we could essentially auto-populate the checkbox. Consider this:
We would probably need to extend the sanitizer logic to detect when embeds get stripped out entirely so that we'd be able to tell the user exactly what is not compatible with AMP. |
In fact, this auto-detection of validation could potentially be used instead of introducing a checkbox at all. It could be entirely determined by validation. This would allow posts/pages to eventually start automatically becoming AMP-compatible once the plugin adds support for more and more embeds. |
I like the thinking here. Still, providing the checkbox may be necessary to enable opting out for specific pages even if they are valid. |
Yeah, let's postpone any integration with the AMP validator for a future enhancement. |
Acceptance criteria:
|
[Edited] Refer to the latest acceptance criteria.
We have a lot of cases where AMP wont work because of some interactive content we have on a particular page. Is there any way to disable amp in the rel link base on a post ID?
The text was updated successfully, but these errors were encountered: