Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
HI,

I am building AMP pages with Couch, and everything works peachy, except that I can't add coded AMP images in the text editor.

In Couch, that works: <amp-img src="<cms:show blog_image />" width="800" height="<cms:show imgsize />" layout="responsive" alt="<cms:show k_page_title />"></amp-img>

But in the text editor, when I enter in source side, with the proper coding - no Couch tags - it translates the amp-img code, and It becomes inedible.

Does anybody know a way around it?

Thanks
Hi Paolo,

That is actually expected behavior. As explained in several previous posts, as a security measure Couch sanitizes all unknown (or potentially unsafe) tags.

Only type 'textarea' editable region can be exempted from this sanitization by using the 'no_xss_check' parameter.
For other regions (primarily the 'richtext' one), the alternative is to use a 'shortcode'.

I think, you should explore the shortcode route - please see viewtopic.php?f=8&t=7950 for one useful implementation.

Hope it helps.
Hi, place this code for your AMP template version
Code: Select all
<cms:php>$content_description = '<cms:show blog_content />';
$content = preg_replace('/style=[^>]*/', '', $content_description);
$html = preg_replace('/<img(.*?)\/?>/', '<amp-img$1 class="type-your-css-style-class-here" width="1080" height="610" layout="responsive" /></amp-img>',$content);
echo $html;</cms:php>
3 posts Page 1 of 1
cron