Blog Sections Open
Escaping introtext Safely for Meta Description Output
If you feed raw introtext into a meta description field, quotes can break the HTML unless you encode the value at the right stage.
A simple but important SEO edge case: when introtext contains double quotes, a meta description built directly from that value can break the final markup.
Broken Pattern
<meta name="description" content="[*desc*]" />
If the TV ultimately resolves to raw introtext with quotes, the final HTML becomes invalid.
Safer Fix
One practical donor solution was to let the TV default to If you feed raw introtext into a meta description field, quotes can break the HTML unless you encode the value at the right stage. and then process the actual introtext value with htmlentities in a custom widget or equivalent normalization step.
if ($value == "[*introtext*]") {
$doc = $modx->getPageInfo($modx->documentIdentifier, '1', 'introtext');
$value = htmlentities($doc['introtext'], ENT_QUOTES, $modx->config['modx_charset']);
}
return $value;
Why This Still Matters
- Meta descriptions should remain valid HTML attributes.
- Projects often reuse introtext automatically for SEO output.
- Encoding must happen after the real document value is known.
If your introtext may contain inline HTML, strip or normalize it before entity encoding so the description remains readable in search snippets.
Fixing a 500 Error on the Manager Login While the Site Still Works
Troubleshoot manager-only 500 errors after migration when the public site still loads correctly in Evolution CMS.
Disabling SEO Strict URLs on Selected Pages
How to keep SEO Strict URLs enabled globally while excluding selected documents during development or storefront edge cases.