Support SEO Optimization 3.0.0 Fix 1: thread meta descriptions are double-escaped

nelsonvergel

Licensed
Licensed
SEO Optimization
Joined
Mar 11, 2025
Messages
1
Reaction score
0
Hello Xen-Soluce team,

I run ExcelMale.com on XenForo 2.3 with [Xen-Soluce] SEO Optimization 3.0.0 Fix 1. Thread meta descriptions are being HTML-escaped twice, so search results show raw entities.

Example: a custom meta description of "based on Nelson Vergel's method" was output as:
Code:
<meta name="description" content="...Nelson Vergel&amp;#039;s method.">
Google then displays "Vergel&#039;s". The same happens with &quot; for double quotes, and it affects both custom descriptions and descriptions generated from the first post. It applies to description, og:description and twitter:description. Meta titles are not affected.

Cause, as far as I can trace it:
  1. Template modification xs_seo "Threads : Meta-Description" on thread_view replaces the $fpSnippet line with:
    Code:
    <xf:set var="$fpSnippet" value="{{ change_description($thread)|raw }}" />
  2. change_description() returns text that is already HTML-escaped (' becomes &#039;, " becomes &quot;).
  3. XenForo's core metadata_macros::description then outputs snippet($description|strip_tags, 160)|for_attr, which escapes the & a second time.
Forum and category pages are fine, because those modifications print {{ $changeDescription|raw }} straight into the meta tag without going through metadata_macros.

Workaround I applied in a custom template modification that runs after yours:
Code:
<xf:set var="$fpSnippet">{{ $fpSnippet|replace({'&#039;': "'", '&quot;': '"', '&amp;': '&'})|raw }}</xf:set>
Suggested permanent fix: have change_description() return plain text for the thread_view path (or decode it before it reaches $fpSnippet), so metadata_macros escapes it only once.

I'm happy to provide more details or test a patch.

Thank you,
Nelson Vergel
ExcelMale.com
 
Back
Top Bottom