Amp-wp: Support for Pages

Created on 8 Feb 2016  Â·  10Comments  Â·  Source: ampproject/amp-wp

[Edited] Refer to the latest acceptance criteria.


At a minimum, they should have:

  • slightly different template
  • appropriate JSON metadata

We may need to adjust actions/filters to allow targeting posts or pages specifically.

PRs: #188, #619.

Enhancement P0

Most helpful comment

How is support for Pages coming along? I feel like Pages-support is mandatory for this plugin to take off. I'm psyched to give it a shot when support comes, since very few sites that I operate actually use posts.
Also, will Pages-support mean that there will also be support for Custom Post Types?

All 10 comments

I'm working on this now. Are there specific areas regarding the JSON schema that you're thinking about?

FWIW, the template renders fine for pages in the work I've done. Not sure much needs to be done to the template outside of removing displayed meta...

How is support for Pages coming along? I feel like Pages-support is mandatory for this plugin to take off. I'm psyched to give it a shot when support comes, since very few sites that I operate actually use posts.
Also, will Pages-support mean that there will also be support for Custom Post Types?

Acceptance criteria:

  1. WordPress core page post-type support will be added.
  2. Similar to how Posts are currently, Pages will be capable of being AMPlified.
  3. A new checkbox will be added to the Settings page (defined in 798), “Pages”.
  4. “Pages” will be checked (enabled) by default, but allow the user to deselect (disable) if they wish to do so.
  5. The settings applied to the “Pages” checkbox on the Settings page will default the AMP status for all pages within the site that are AMPlifiable.
  6. If a specific page has AMP disabled (see rules in #709), the page will not be AMPlified.
  7. The AMP versions of URLs may include ?amp even with pretty permalinks enabled. This may turn out to be required to play nicely with rewrite rules generated for pages to disambiguate from pages about someone's favorite guitar amp, for example.

If a specific page has AMP disabled (see rules in #709), the page will not be AMPlified.

This will be especially important in the case of pages with user-supplied page templates. If a page template has functionality in it that is hard-coded in PHP and showing the page in the AMP template is just not going to be acceptable, then a user would need to disable AMP for the page. We may want to consider defaulting AMP to “disabled” when a custom page template has been selected.

One more thing to note on acceptance criteria: the AMP versions of URLs _may_ include ?amp even with pretty permalinks enabled. This may turn out to be required to play nicely with rewrite rules generated for pages to disambiguate from pages about someone's favorite guitar amp, for example.

One more thing to note on acceptance criteria: the AMP versions of URLs may include ?amp even with pretty permalinks enabled. This may turn out to be required to play nicely with rewrite rules generated for pages to disambiguate from pages about someone's favorite guitar amp, for example.

@westonruter I added that to the ACs.

See PR #825 which is pending merge to resolve this issue.

Went to Contact Us page at http://amp-xwp-testbed.pantheonsite.io/contact/?amp which has AMP enabled. I ran an AMP Validator extension and it noted the attached error.
image

@csossi Thanks for that. This is actually something that I had done as part of #819 but deployed to the testbed prior to merging the PR.

I fixed the issue here: https://github.com/Automattic/amp-wp/pull/819/commits/a38d024a8e5dcc82d9bb79b7b2b1a21edad0d7b7

Re-deployed and the issue has been resolved: http://amp-xwp-testbed.pantheonsite.io/contact/?amp#development=1

verified in QA

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexhaller picture alexhaller  Â·  5Comments

miina picture miina  Â·  4Comments

fumikito picture fumikito  Â·  5Comments

luizeof picture luizeof  Â·  4Comments

swissspidy picture swissspidy  Â·  4Comments