Automattic / Automattic/jetpack

Related Posts: Shortcode version is not AMP-compatible

Open
#14,584 5 comments 0 reactions 0 assignees View on GitHub
[Feature] Related Posts [Pri] Low AMP Enhancement
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:**

![image](https://user-images.githubusercontent.com/177561/73874449-6171af00-4808-11ea-9c1a-ca77c97a0480.png)

**With AMP enabled:**

![image](https://user-images.githubusercontent.com/177561/73874423-56b71a00-4808-11ea-900c-19e4fb955a92.png)

Contributor guide

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.