ClassicPress/classicpress-seo

Page builder (DIVI) shortcodes in meta description not being correctly processed on frontend

Closed this issue · 0 comments

Intro

If the meta description field on the page edit page is not completed manually by the user, the default is used. In most cases this seems to work fine. It extracts the first 160 characters from the body text and this is added to the <meta name="description" content=""/> on the frontend.

If using a page builder such as Divi, this also seems to work fine most of the time. However, there are occasions when it may not work as expected.


The Issue

If using the default, auto-generated meta description using a page builder such as Divi, the meta description preview on the edit page may look fine. However, if you look at the source for the frontend of the page, the meta description may show Divi shortcodes instead of standard text as in the following example:

Manually entered description

<meta name="description" content="This is an example meta description entered manually. It is not auto-generated. The theme is Divi 3.20.2. This should display without problem."/>

Auto-generated description

<meta name="description" content="[et_pb_section bb_built=&quot;1&quot; admin_label=&quot;Header&quot; custom_padding_last_edited=&quot;on|tablet&quot; _builder_version=&quot;3.20.2&quot; background_image=&quot;https://www.example.com/wp-content/uploads/2019/04/my_background_image.jpg&quot; custom_padding=&quot;3vw||3vw|&quot; next_background_color=&quot;#f2f2f2&quot;]"/>


How to reproduce

The only way I've been able to reproduce this (in Divi) is by starting the page with a standard section containing a background image like so:

divi-meta-description-header


Other Info

This issue may affect other page builders such as Elementor and Beaver Builder but no testing has been done on either of these two yet.


Workaround

The obvious workaround for now is to make sure that the meta description field for all pages is completed manually.