THE PROBLEM

AMP has matured and expanded dramatically since the module was first created. At that time AMP was expected to be used on a few "news" pages of a site, not as the primary content of the site. The assumption is that you would have a "real" page, the canonical page, and a stripped-down version as the AMP page. There were only a few AMP elements, a text element, an image element, a few others.

The current state of AMP is totally different. The library of elements has exploded to include advertising, analytics, numerous variations of image, video, and social posts. It's not just static content any more, it can be interactive content with personalization, sidebars, animation and more. It's not just for a few pages on the site any more, it could be for any page on the site. In fact, Google recommends using AMP for landing pages so your landing pages load fast. Some publishers are creating sites that are AMP-only, where the AMP page IS the canonical page and there is no other version. There are even more things coming, like AMP stories and AMP email.

The current module is not well-equipped for this new world. It handles the original cases but not much more. We need a complete rethinking of the code and architecture. At the same time, there are sites using the current module who may not want or need anything more than they now have. So we need to be conscious about not breaking backwards compatibility.

AMP requires Schema.org metadata be represented in the head of the document as JSON-LD. The AMP module provides a page where some very simple Schema.org elements can be configured. It's not extensible and it only appears on AMP pages and nowhere else. The code that creates this simple implementation is extensive, representing perhaps one-third of the code in this module. This code also represents a significant number of the issues and support requests on the AMP module.

The Schema.org Metatag module now provides a flexible and extensible way to display Schema.org metadata on every page using JSON-LD. But the AMP module currently won't support it and will strip it out.

ROADMAP

Here is my suggested roadmap. Create two new branches of the module as follows:

8.1 - the current branch is to be deprecated once users have a chance to upgrade.
8.2 - the same as 8.1, but remove all the code related to Schema.org metadata and ask users to use the Schema.org Metatag module to configure JSON-LD for their sites. Since this breaks backward compatibility, it needs to be a new branch. The codebase will be much smaller with all that code removed and hopefully easier to maintain. It should be stable enough for existing sites to continue to rely on.
8.3 - a branch to re-architect the AMP module to support things like AMP landing pages, AMP-only sites, and new interactive AMP elements.

PHASE 1

  1. Create the new branches and update documentation about the way this works and the path forward.
  2. Remove all the code related to creating and maintaining the JSON-LD metadata.
  3. Close all issues and bugs related to the way the metadata works and point users to the Schema.org Metatag module as a better solution.
  4. Fix critical bugs in the 8.2 branch, but add no new features.

PHASE 2

Start a new 8.3 branch. Rethink the architecture and rebuild it from scratch. Some initial ideas:

  • Create a way to use AMP on landing pages and the home page.
  • An AMP-only site won't need all the code that negotiates between the AMP and non-AMP version of a page. Move all that code to an optional module.
  • Leave the AMP module mostly as a module that defines the APIs and provides core functionality needed for any use case.
  • Create re-usable base classes, services, and traits for AMP formatters, to ease the process of creating formatters for the many new elements.
  • Explore ways to make existing themes work with AMP without whole-scale rewrites. For instance, create a way to automatically write all css into a style tag instead of as links to avoid the need to hard-wire the css into the theme.
  • Think about how to support something like AMP Stories or AMP Email.

Code optimization

New features in AMP module

New features in AMP theme

Comments

KarenS created an issue. See original summary.

karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Version: 8.x-1.x-dev » 8.x-3.x-dev
sarathkm’s picture

What about updating Lullabot AMP library validate-generator.php and its associate files.

Some stuff not working as it does not validate new stuffs in amp pages which were introduced since its last release, like amp-sidebar multiple declaration on same page removes duplication on same page by lullabot amp library.

Will amp 8.x-3.x also allows support for implementation of PWA in AMP?

karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Related to #10, that is already on the list. I don't have the time or skills to do that so it won't happen unless someone steps up to do it. The library is adequate to convert the body field, just not to convert the whole page (which was called Power User mode). I've already moved the whole-page conversion into separate module that is marked as not recommended. It is possible to use this module without that, it just requires the themes to strip out libraries that would inject javascript, etc. If you use 8.3 with the updated 8.3 themes and without that non-recommended module, all the new AMP components should work.

karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Issue summary: View changes
karens’s picture

Status: Active » Fixed

Most of the things in this roadmap have been addressed. The couple that are unfinished are in the issue queue and will be handled there. So I'm closing this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.