Support » Plugin: AMP » What makes a theme compatible with the AMP plugin?

  • Resolved isachenx

    (@isachenx)


    I’m confused between the AMP theme framework and this AMP plugin. From what I understand, this AMP plugin cannot work without an AMP ready theme. But am I right in assuming that an AMP ready theme does not have to be a theme built on the AMP theme framework? So what makes a theme compatible with this plugin?

    • This topic was modified 4 weeks, 1 day ago by isachenx.
    • This topic was modified 4 weeks, 1 day ago by isachenx.
Viewing 1 replies (of 1 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    To use Standard or Transitional modes, you should use a theme that is AMP-compatible. In these modes, the AMP plugin serves the active theme’s templates and stylesheets in AMP pages. When it is generating AMP pages, the plugin will remove any markup that is not valid AMP. Primarily what this will involve is invalid script elements. What this will mean is the theme will behave as if JavaScript is turned off in the browser, since all custom scripts will be removed (since they are not allowed by AMP). So as long as the theme has graceful fallbacks in place for when JS is disabled in the browser, then you’ll get a good baseline AMP experience. You can then progressively enhance the theme (such as with a child theme) to add the use of AMP components to add the interactivity that was present in the non-AMP version. Themes that are “AMP ready” will make use of AMP components for implementing interactivity when serving AMP pages.

    As an example of this, consider the Noto Simple theme on WordPress.org: https://wordpress.org/themes/noto-simple/

    This theme is not AMP-compatible, but it works in AMP except for the nav menu on mobile, and the scroll-to-top button doesn’t appear. Here is a child theme of Noto Simple that shows how to make the AMP version have full parity with the non-AMP version: https://gist.github.com/westonruter/b904977a296da091584a7a2264df2882

    Otherwise, if you do not have a theme that is AMP-compatible, then the plugin includes the “Reader mode” which will serve posts and pages using a basic template that is distributed with the plugin.

    But the ideal use of the plugin is to use an AMP-compatible theme and to use Standard mode. In this way, you get the site theme’s unique design and you don’t have to maintain two separate versions, since there is only an AMP version to develop for, and this is served to both desktop and mobile visitors.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.