Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Problem creating custom AMP plugin

Started by Muut Archive 9 years ago · 3 replies · 437 views
9 years ago

Hi there,

I'm trying to create my own amp plugin. Right now I'm just replacing <img> with <amp-img> in the AMP version of a page. It's working, but problem is that it seems that grav is using the same cache versión for both pages. So if I clear cache and try to load my amp version:
http://blablabla.com/home.amp
all <img> are replaced with <amp-img>
But if I try to load the normal html version
http://blablabla.com/home
images are still replaced with <amp-img>

If I clear the cache and load first the normal html version
http://blablabla.com/home
<img> are not replaced, but when I try to load the amp version
http://blablabla.com/home.amp
no <img> are replaced with <amp-img>

Of course, I don't want to disable cache for this pages since they need to be fast.
Any thoughs?

Thank u

9 years ago

How did you setup your AMP implementation? I added a default.amp.twig to my theme and tried visualizing my page with .amp extension, all fine. Is that a modular page? Things might change in that case.

9 years ago

Hello flaviocopes,

Its a blog page (item.amp.twig), and it's working fine, but only if I use cache_enable: false
if I left the cache enabled the behaviour is the one I have described on the first post

9 years ago

I tested that too. Do you have additional caching plugins installed?

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1341 9 years ago
Archive · by Muut Archive, 9 years ago
2 928 9 years ago
Archive · by Muut Archive, 9 years ago
2 4057 9 years ago
Archive · by Muut Archive, 9 years ago
1 2942 9 years ago
Archive · by Muut Archive, 9 years ago
3 1115 9 years ago