Open enonicnorway opened 12 years ago
We should also account for new-lines in the description that will also break validation. Here I just added normalize-space() to the description output and added translate() for the keywords to turn newlines into commas.
<xsl:if test="normalize-space($description) or normalize-space($stk:head.meta-description)">
<meta name="description" content="{if (normalize-space($description)) then normalize-space($description) else normalize-space($stk:head.meta-description)}"/>
</xsl:if>
<xsl:if test="normalize-space($keywords) or normalize-space($stk:head.meta-keywords)">
<meta name="keywords" content="{if (normalize-space($keywords)) then translate($keywords, '
', ',') else translate($stk:head.meta-keywords, '
', ',')}"/>
</xsl:if>
In the head.xsl file, it outputs the keywords exactly as written. But some people put each keyword on a new line (in the page properties tab) instead of making a comma separated list. This causes the output to look like this myeloid leukaemia leukemi instead of myeloid leukaemia,leukemi,
translate($stk:head.meta-keywords, ' ', ',')
Line 61