This project is read-only.

Home Page removing formatting of posts.

Topics: Business Logic Layer, Controls
Sep 21, 2011 at 3:05 AM
Edited Sep 21, 2011 at 3:07 AM

Hi reader.

I just upgraged my wifes blog to blogengine 2.5. The problem I have is that on the homepage, the page is removing the formatting of the posts, however if you click to read the full post, the formatting returns!
The call in posts.ascx is: @Html.Raw(Model.Body)
But i feel it has to do with the control that shrinks the post to a certain amount of characters - which is great, but its stripping formatting!

Any ideas on how to still show the shortened post on the home page but with full formatting? My wifes blog is if you need to see it in action.

Thanks in advance you helpfull people!


Sep 21, 2011 at 1:42 PM

I think the formatting is removed/stripped when you check the "Only Show Description of Posts" setting under Settings -> Basic in the control panel.  I'm guessing you have that checked and probably a number below it to indicate how many characters to show.

That is a convenient way to shorten the posts for the homepage, but then has that side effect.  Another option would be to uncheck that, and in each post, you can type [more] where you want the cut-off to be for the homepage description.  The [more] functionality does preserve the HTML formatting without stripping the HTML.  You can test it out with a test post to make sure.  If you go w/ this, make sure the "BreakPost" extension is enabled on the Extensions tab in the control panel.  It's that extension that makes [more] work.

One advantage of [more] is that you can control the cut-off point for each post ... where in one post you might want the cut-off point to come earlier than it does in another post.  The disadvantage of switching to [more] is that you'll have to add [more] to all the existing posts.  And if you do use [more], make sure that the "Only Show Description of Posts" checkbox is unchecked as you will want to avoid having both of them on.

Sep 21, 2011 at 1:48 PM

Incidentally, although it comes down to personal preference, I myself prefer that the formatting is stripped on the homepage descriptions.  One advantage of the stripping is it keeps the homepage descriptions short and uniform with plain text.  For example, this post starts off with a picture (an IMG tag).  If HTML formatting was not stripped, then that IMG tag would appear on the homepage description.  So rather than having a short, succinct paragraph for that post on the homepage, you would have this big picture with a couple of sentences following it ... the description for that post on the homepage would be much taller than the descriptions you have for the other posts.  Anyhow, maybe you are aware of this, but just thought I'd bring it up.

Sep 21, 2011 at 5:57 PM

Hi Ben,

Thanks so much for your reply, really appreciated. I will try and use the [more] filter. Thats actually the reason why we wanted the formatting, so that at least the home page would show some sort of image for each post to provide a visual aspect of the article. I guess we will then need to keep all the images consistent, and also the location of the [more] consistent so that it has nice equal heights.

Thanks again Ben, Really appreciate your help!

Best Regards,