Skip to content

Allow external preview links in Preview dropdown to be extended #25309

@westonruter

Description

@westonruter

In the AMP plugin, we introduce a separate Preview button to be able to preview how the page appears in AMP. We had to put in place a bunch of hacks to get this to work in the block editor since the area around the preview button is not extensible. See ampproject/amp-wp#4397. The button looks like this (screenshot courtesy of @simison):

AMP Preview button

Unfortunately, this broke in Gutenberg 8.8. But this is not surprising since it was implemented with hacks. We actually don't want to have a separate AMP preview button in the first place. Ideally the AMP preview link would be exposed in the relatively new device preview dropdown (ampproject/amp-wp#4368 (comment)), as also was suggested in Automattic/wp-calypso#42896:

Preview dropdown

However, we weren't able to do so given that this dropdown is not extensible.

So my request is that the Preview dropdown menu items be extensible. Plugins should be able to add their own preview links in addition to "Preview externally". This will be useful not only for AMP, but it could also be used by other plugins that may provide alternate representations of the content (e.g. FB Instant Articles, Apple News) or even as a way to link to preview the content on a site that is using WordPress headlessly.

This relates to #21235 which is about extending the non-external preview options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions