I note seen this asked in Kirby 3 context
I am using representation to direct to AMP content by adding .amp to the end of the page URL
But how do I change how KirbyText renders based on this.
For example <img>
becomes <amp-img>
I would rather not have to have 2 contents, but a single content rendered slightly different.
Is this possible?
You could replace image tags/other tags that need to be modified with a kirbytext:after hook.
I’m not familiar with AMP requirements, but you could also create alternative tags, and then use kirbytext:pre
hooks to replace (img:
with (amp-img
), etc.
You mean replace every single tag? Would that not also break the drag drop of images into articles?
I have hundreds of pages, so was hoping for a one hit solution.
That filter would then be applied everywhere (well, conditionally if AMP page).
What I meant was, I would need to replace every single image kirbytag? Or could I extend the image kirbytag?
Sorry I have not used this hook, and not quite following it.
As I said, the filter would then automatically replace every tag.
An alternative would be this here: Deactivate specific tag (or plugin) on AMP version - #2 by Pascalmh
You could also extend the tag.
I will have a look, still massively confused, the hook docs don’t really tell me anything.
Is there docs on extending a single kirbytag? And not sure how to detect a reflection at the moment?