sachatrauwaen / OpenContent

Structured Content editing for DNN (Dotnetnuke)
46 stars 25 forks source link

{{convertHtmlToText Description}} does not fully work in detailMetaDescription #92

Closed b-creative closed 3 years ago

b-creative commented 5 years ago

When using <div>{{convertHtmlToText Description}}</div> in the template, it returns clean text. But when using "detailMetaDescription": "{{convertHtmlToText Description}}" in the manifest, it returns text including spaces (when replacing HTML elements like <p>), new lines (when a <br> is present) and (when present in the description) a non-breaking-space (&nbsp;).

Is there a way to prevent this?

Thanks!

Timo-Breumelhof commented 3 years ago

I think in both cases spaces and newlines are returned, but they are not visible in an HTML view. convertHtmlToText converts HTML to Text and having spaces and \n in there is by design.

https://github.com/dnnsoftware/Dnn.Platform/blob/9f83285a15d23203cbaad72d62add864ab5b8c7f/DNN%20Platform/Library/Services/Mail/Mail.cs#L27

Maybe we need an extra function like removeWhiteSpace (?)

Timo-Breumelhof commented 3 years ago

you can use {{replacenewline Description ""}} too btw