Accelerated Mobile Pages (AMP) for MODX Evolution
http://www.tattoocms.it/extras/snippets/ampx-accelerated-mobile-pages-amp-for-modx-evo.html
- template amp-blank
- richtext: no
- content: [!ampx!]
- pagetitle: amp
<link rel="amphtml" href="[(site_url)][~57~]?ampid=[*id*]" />
<link rel="amphtml" href="[(site_url)][~57~]?ampid=[*id*]&tpl=amp-Template-Home" />
<link rel="amphtml" href="[(site_url)][~57~]?ampid=[*id*]&tpl=amp-Template-Container" />
<link rel="amphtml" href="[(site_url)][~57~]?ampid=[*id*][[if? &is=`[*id*]:=:1` &then=`&tpl=amp-Template-Home`]]" />
<link rel="amphtml" href="[(site_url)][~57~]?ampid=[*id*][[if? &is=`[*isfolder*]:is:1` &then=`&tpl=amp-Template-Container`]]" />
- add AMP to children of Resource 3
- use Amp-Template-Container for resource id 4,67,70,104,159
- use default template for any other resource inside id 3
[[if? &is=`[*parent*]:in:3` &then=`[[if? &is=`[*id*]:in:4,67,70,104,159` &then=`<link rel="amphtml" href="[(site_url)][~57~]?ampid=[*id*]&tpl=amp-Template-Container" />` &else=`<link rel="amphtml" href="[(site_url)][~57~]?ampid=[*id*]" />`]]` &else=``]]
IMPORTANT: Replace 57 with the ID of resource created at Step 2
Issue:
- validation error with any active plugins that loads something (like js to the page code) with OnWebPagePrerender
#Updates:
- parent placeholder (get parent id from document)
- added noimage parameter
- added striphtmlattributes from content (with simple_html_dom) to remove tinymce style attributes
- changed author: fullname instead username
- added dateModified from editedon
- Better structured data
- amp-Template validation for amp and structured data
- Social Share chunk #3
- Sidebar navigation based on wayfinder
- Support for Homepage and Containers (category) pages
- now, you can pass tpl parameter to url
- new templates for Home and Containers
- ditto tpl
- more placeholders
- added snippet folder
- image sanitize
- new template
- added author placeholder
- first commit