[tip] sidebar navigation on google cached pages (for faster amp pages loading)
Closed this issue · 2 comments
Nicola1971 commented
late night idea not tested:
tip: sidebar navigation on google cached pages (for faster amp pages loading)
ie:
wayfinder row tpl
for http sites:
https://ampbyexample.com/advanced/using_the_google_amp_cache/
Example:
https://cdn.ampproject.org/c/tattoocms.it/amp.html?ampid=172
Nicola1971 commented
Snippet
<?php
/* ampcache_path Snippet
* [[ampcache_path]] for http sites
* [[ampcache_path? &secure=`1`]] for https sites
*/
$secure = isset($secure) ? $secure : '0';
$httpcachepath = "https://cdn.ampproject.org/c/";
$httpscachepath = "https://cdn.ampproject.org/c/s/";
$siteurl = $modx->config['site_url'];
$host = parse_url($siteurl, PHP_URL_HOST);
$host = preg_replace('/^(www\.)/i', '', $host);
if ($secure == '1'){
$cachepath = $httpscachepath.$host."/";
}
else { $cachepath = $httpcachepath.$host."/";
}
$ampcache_path = $cachepath;
return $ampcache_path;
?>
Wayfinder row tpl
<li [+wf.classes+]><a href="[[ampcache_path]][~[*id*]~]?ampid=[+id+]
Nicola1971 commented
It is not very useful because Google amp cached pages always opens links with target="_blank