I experimentet a little with AMP before, what I did was: creating my own custom field method:
$kirby->set('field::method', 'amp', function ($field) {
return amp($field->value);
});
//...
function amp($content)
{
$snippets = c::get('ampMarkdownReplacements', [
'(image:' => '(amp-image:',
'(youtube:' => '(amp-youtube:',
]);
$values = array_values($snippets);
$keys = array_keys($snippets);
return str_replace($keys, $values, $content);
}
(you need to change the amp-Function to remove the oembed code…)
Then use it like this in your templates: <?php $maincontent = kirbytext(amp($page->text())) ?>
What I did was creating “amp markdown code” which I transformed to AMP-HTML using custom tags.