Rule: Strip HTML Tags#

This rule removes HTML tags from the content of an element.

Extra features#

  • None

Practical examples#

Example 1: Remove HTML tags from product descriptions#

For example: <strong>, <br>, <p>

1. Creating a new rule:

  • Open the “Rules” page.
  • Click the New rule button.

2. Selecting the rule type:

  • In the Rule type field, select the Strip HTML Tags option.

3. Selecting products:

  • In the Query field, choose either All products or create your own Product query for specific products you want the rule to apply to.

4. Choosing the element to change:

  • In the Element field, select the element you want to modify.
    • In our case, this will be the product description (description)

5. Naming the rule:

  • In the last step, enter the rule name, for example “Remove HTML tags from description element”.

FAQ#

What is the Strip HTML Tags rule for?#

This rule removes all HTML tags from the content of the selected element, such as <p>, <br>, <strong>, <a>, etc. It is most commonly used for:

  • cleaning product descriptions before export,
  • preparing texts for platforms that do not support HTML (e.g., Google Merchant Center),
  • unifying content for export to simple CSV or XML feeds without formatting.

What exactly is removed from the text?#

All HTML tags including their attributes are removed, e.g.:

<p><strong>New collection</strong> -- free shipping!</p> ➡ Result: New collection -- free shipping!

The rule does not remove text content, only the tags.

Are HTML entities like &nbsp or & also removed?#

No. The rule removes only HTML tags. Entities like &nbsp; (non-breaking space), &amp; (ampersand), or &euro; (euro symbol) are preserved. 💡 If you want to remove or replace them, use the Find and replace rule afterward.

Can the rule be applied to elements other than product descriptions?#

Yes. You can apply it to any text element, for example:

  • g:title – if HTML tags have crept into product names,
  • custom_label_0 – if it contains formatted text,
  • or even g:product_type, if it was imported from an HTML source.

Does removing HTML tags affect the XML feed structure?#

No. The rule works only with element content, not with its structure. Your XML remains valid – Mergado never removes the XML elements themselves, only HTML code stored in their text.

Can the rule be applied to only some products?#

Yes. In the “Query” field, you can choose All products or only a specific Product query (for example, only products from a certain category or supplier).

Can the rule damage text (e.g., remove something that is not HTML)?#

No. The rule recognizes actual HTML tags by their syntax (<tag>...</tag>). It will not delete text that merely contains the characters < or > without a closed HTML pair.

Can the rule be combined with other text cleaning rules?#

Yes – this is actually the recommended approach. After removing HTML tags, you can use:

  • Find and replace – for removing entities like &nbsp;,
  • Remove diacritics – for preparing data without accents,
  • Truncate value – if you need to limit text length after cleaning.

How do I check if the rule worked correctly?#

After saving and applying the rules or after regenerating the feed, check the result:

  • in the product preview, or
  • using the Rule walkthrough feature, where you can see exactly how HTML tags were removed from the specific element.
🇨🇿 🇬🇧 🇩🇪 🇭🇺