I've received an mail from Google about AMP pages.
I don't have php knowledge to understand or port the Revo plugin to Evo, so i've struggled a lot of days how to do AMP pages in Evo with my poor skill
First idea was something like a
template switcher, but I remeber a lot of caching issue with the old Evo TemplateSwitcher plugin by Susan:
you must have uncached pages to switch template in Evo.
So, today i've tried a different approach
The logic and the code is very simple:
1) get the document id of the resource
2) get page infos (title, content, description, pub date..) from the resource id
3) parse everything in a chunk containing an AMP html template
NOTE: it's a very beta release and there are a lot of AMP features to add (I have not read all the amp documentation ) and MODX issues to fix
It is not an elegant solution (there is no friendly url), but it seems to work for blogpost/content pages:
https://github.com/Nicola1971/ampx
Installation with Packagemanager
Step 1) Create a new resource:
- template amp-blank
- richtext: no
- content: [!ampx!]
- pagetitle: amp
Step 2) Add to the HEAD tag of your default Post Template the link to your AMP version
<link rel="amphtml" href="[(site_url)][~57~]?id=[*id*]" />
IMPORTANT: Replace
57 with the ID of resource created at Step 1
NOTES:
1) this beta support only pagetitle, content, longtitle, description, introtext, pubdate and a custom image tv (with snippet parameter &imageTv=`tvname`)
2) issue: validation error with any active plugins that loads something (like js to the page code) with OnWebPagePrerender
3) issue with snippets inside content
Demo:
Original page:
http://www.tattoocms.it/manager-templates/modxflat-evolution-manager-theme.html
AMP version:
http://www.tattoocms.it/amp.html?ampid=123
Any help or suggestions are welcome
[ed. note: banzai last edited this post 7 years, 8 months ago.]