Did solved this issue by just removing the <h1> Tag from my RTE . But anyone else had the same problem before, truncate doesnt work with <h1> tag or any <h1-<h6> tag.
It might me bacause you specify what html tag to strip. (in your code above you only strip p tags.) Then if your h1 tag plus content is longer than 250 charecters the h1 won't get a closing tag. And therefore the rest of your page is now a part of that h1 tag.
But if you don't specify what tag to strip but just leave it at Library.StripHtml(Model.bodyText) all of the content will be striped and you are free to truncate it.
I did try Library.StripHtml(Model.bodyText) but this is not the issue, its only when i Truncate the bodyText that the content is not rendering well since i have html tag <h1 - h6>.
Have you checked what output you get in the final rendered HTML? In my mind and in my little local test the problem can most likely only happen if some tags are not closed correctly.
Truncate RTE is removing part of my Content
Hi,
Am having some very weird issues here where my content text in RTE is not displaying well when i try to truncate the content.
Part of the content in my Rte has classes such as <h1 class="" >
Any idea what might be causing this ?
Weird when i try to truncate the content RTE i get this as output
and without the truncate
<h1 class="sub">Title 1</h1>
Did solved this issue by just removing the <h1> Tag from my RTE . But anyone else had the same problem before, truncate doesnt work with <h1> tag or any <h1-<h6> tag.
/fuji
Hi, What is rendered by @Library.StripHtml(content.GetProperty("bodytext").Value.ToString(),"p")?
If its not that causing the problem then i guess its a bug or a parameter is missing or incorrect :). Charlie
It might me bacause you specify what html tag to strip. (in your code above you only strip p tags.) Then if your h1 tag plus content is longer than 250 charecters the h1 won't get a closing tag. And therefore the rest of your page is now a part of that h1 tag.
But if you don't specify what tag to strip but just leave it at Library.StripHtml(Model.bodyText) all of the content will be striped and you are free to truncate it.
Hi Kasper,
I did try Library.StripHtml(Model.bodyText) but this is not the issue, its only when i Truncate the bodyText that the content is not rendering well since i have html tag <h1 - h6>.
Have you checked what output you get in the final rendered HTML? In my mind and in my little local test the problem can most likely only happen if some tags are not closed correctly.
Like...
But if the HTML is striped completly:
is working on a reply...