elementor / wp2static

WordPress static site generator for security, performance and cost benefits
https://wp2static.com
The Unlicense
1.42k stars 270 forks source link

Support for AMP pages #796

Open petewilcock opened 3 years ago

petewilcock commented 3 years ago

One of my themes generates AMP pages for Wordpress, either at ?amp or /amp, but currently these aren't crawled.

I believe the correct AMP URL as recognised by Google is without the trailing slash, so this might be challenging. But in the short-term, I could work with crawling ?amp and having this indexed as /amp/index.html.

For the CloudFront->S3 part I can put a function in front of the request and rewrite it to return a valid response for ?amp.

🙏

leonstafford commented 3 years ago

Wondering if this should go into an add-on or core. My dislike of AMP has me leaning to an add-on.

A few ways to approach it - we could detect for common AMP plugins or in this case, the theme's classes, to see if we should generate the URLs to be crawled.

Is my assumption about AMP that they're just static pages, so we could possibly do it in post processing phase and duplicate + rewrite a copy of the whole site into an /amp/ dir? Or, do we want a dumbed-down version of the pages for AMP, which the theme/plugin modifies the output for, different than mobile pages?

An uglier approach may be to make a request to /amp/ or /?amp, looking for a 200, to determine if we crawl an extra AMP URL for every other detected path in the site...

What do you think would be most useful?