htmltinymceprestashopwysiwygmicrodata

How to avoid PrestaShop WYSIWYG editor to clear Microdata?


I use PrestaShop to create some CMS pages in HTML. I would like to add some Schema.org structured data into my code, but when I paste the HTML and save the page, all the Microdata disappears. I guess the WYSIWYG editor doesn't allow me to add that.

Example

<div itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">

PrestaShop keeps the <div> and clears the Microdata attributes. Do you know a way to solve that?


Solution

  • Make sure that in your backoffice Shop Parameters > General "Use HTMLPurifier Library" is turned off.

    This will prevent TinyMCE to remove some HTML content during validation.

    If your micro-data content is still wiped, you should either apply some modifications in core during TinyMce initialisation , or (better) develop a simple module that inject your Microdata in CMS pages with Prestashop hooks.