Automattic / Automattic/jetpack
Related Posts: Shortcode version is not AMP-compatible
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
#### Steps to reproduce the issue
1. Start with a site with Related Posts enabled.
2. Install the [AMP plugin](https://wordpress.org/plugins/amp/); set the site to use 'Transitional' mode so AMP/non-AMP versions can be easily compared.
3. On a post, add the `[jetpack-related-posts]` shortcode and the Related Posts block.
4. Save and publish.
5. Confirm you have three sections of related posts on the published page (the shortcode, the block, and the one that appears after the content.
6. In the Admin Toolbar, select 'View AMP version' of the post.
#### What I expected
All three Related Posts sections would still be visible.
#### What happened instead
The shortcode version disappears; the block and one at the bottom of the page remain.
Understandably, the the block is meant to replace the shortcode in the content, but using `do_shortcode()` is also currently the recommended way to move the Related Posts section; doing this will also result in a section that won't display when AMP is enabled.
(Similar-ish to #14397, but I assume this shortcode isn't listed there because the block is AMP-compatible.)
**Screenshots**
**Without AMP enabled:**

**With AMP enabled:**

Contributor guide
Research direction
Reproduce the issue with Related Posts enabled, the [jetpack-related-posts] shortcode, the block, and AMP in Transitional mode. Compare the published non-AMP and AMP versions; done means the shortcode-generated Related Posts section remains visible in the AMP version alongside the block and bottom section.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100