'content' => $resource->get('content')
<h1>[[+amp_ptitle]]</h1> <amp-img src="[[+amp_image]]" alt="[[+amp_ptitle]]" width="[[+amp_image_width]]" height="[[+amp_image_height]]" layout="responsive"></amp-img> <article>[[+amp_content]]</article>
$modx->setPlaceholders(array( 'ptitle' => $resource->get('pagetitle'), 'pdescription' => $resource->get('description'), 'content' => $resource->get('content'), 'canonical' => $modx->makeUrl($resource->get('id'),'','','full'), 'published' => $resource->get('publishedon'), 'edited' => $resource->get('editedon'), 'image' => $image_url, 'image_width' => $width, 'image_height' => $height ),'amp_');
'content' => $resource->get('content'),
'content' => $resource->get('amp-content'),
'content' => $tvr->get('amp-content'),
This question has been answered by BobRay. See the first response.
How are you serving amp pages currently is it via the amp pages extra, switch template extra or another way? In the first two extras you're serving a different template anyway for amp pages so you could just replace the tvs with some amp specific created ones.Like this:
'content' => $resource->getTVValue('amp-content'),
$modx->setPlaceholders(array( 'ptitle' => $resource->get('pagetitle'), 'pdescription' => $resource->get('description'), 'content' => $resource->get('content'), 'content' => $resource->getTVValue('amp-content'), 'canonical' => $modx->makeUrl($resource->get('id'),'','','full'), 'published' => $resource->get('publishedon'), 'edited' => $resource->get('editedon'), 'image' => $image_url, 'image_width' => $width, 'image_height' => $height ),'amp_');
$tvValue = $resource->getTVValue('amp-content'); $docContent = empty($tvValue)? $resource->get('content') : $tvValue; $modx->setPlaceholders(array( 'ptitle' => $resource->get('pagetitle'), 'pdescription' => $resource->get('description'), 'content' => $docContent, 'canonical' => $modx->makeUrl($resource->get('id'),'','','full'), 'published' => $resource->get('publishedon'), 'edited' => $resource->get('editedon'), 'image' => $image_url, 'image_width' => $width, 'image_height' => $height ),'amp_');
$fields = $resource->toArray(); $tvValue = $resource->getTVValue('amp-content'); $fields['content'] = !empty($tvValue)? $tvValue : $fields['content']; $fields = $array_merge($fields, array( 'canonical' => $modx->makeUrl($resource->get('id'),'','','full'), 'image' => $image_url, 'image_width' => $width, 'image_height' => $height, )); $modx->setPlaceholders($fields, 'amp_');
I think this would do it:Thank you, BobRay, it works!