Displaying Excerpts and a multiblog page with Blog4Umbraco
Hi All,
I'm new to Umbraco but so far it seems to be heads and shoulders above anything I've ever used. I couldn't find a solution to this anywhere in the current forums. I am currently using it to move my company's network of 6 blogs onto our own server and off of blogger. I set up the blogs very easily with Blog4Umbraco but not have some questions about extending it.
The first is on each blog starting page, it displays the entirety of each post. I'd like it to show 12 lines or so for the most recent post and only about 5 lines for each the next few. I don't really know how to go about implementing this...any points in the right direction would be a hugeeeee help.
The second is a bit of a different issue with some similarities. I need a network homepage that displays most recent posts from all the blogs that are child nodes of the page. Also, like the first issue, this needs to display 12 lines or so from the most recent post and only 4 or 5 from the previous ones.
Thanks in advance for any help or clues as to solving this puzzle.
The excerpt of a post is a bit of a classic dilemma. There are a few ways of doing this sort of thing:
1: Add a new property on the blogpost type, to manually enter the excerpt.
2: Strip the html, and take the first x chars of the body text
3: Do some intelligent parsing of the post so you can f.ex. render the first three <p> sections of the post
4: Have the editor insert some sort of split identifier in the post. This might pa something like putting a class on a paragraph like <p class="split">. Then use this identifier to get the excerpt.
So what route you want to take is probably up to how your writers like to work, and how much you like manipulation strings :-) The main thing is to be aware not to cut off the body text's html in the middle of a paragraph or similar.
With regard to the network page, I guess that depends on your site structure. You will probably get a long way by just copying the standard list macro, and insert it on your top page, since it probably just looks for descendant blogposts. If your network page is a sibling to the blogs, then you might need to do a bit more work.
There's an old post (http://forum.umbraco.org/yaf_postst5376_META-Description.aspx) that discusses stripping out the first xx characters in xslt. This should point you in the right direction.
Thanks for all your help and such a fast response.
"With regard to the network page, I guess that depends on your site
structure. You will probably get a long way by just copying the
standard list macro, and insert it on your top page, since it probably
just looks for descendant blogposts. If your network page is a sibling
to the blogs, then you might need to do a bit more work."
I thought there might be something like this...my main concern is that I want it to be the most recent posts from all 6 blogs combined. Is this still something that the standard list macro would be able to accomplish. All blogs are child nodes of the network page.
As far as the posts go, I agree that I need to be careful about not cutting posts in the middle of paragraphs or even words! I think maybe working it so it takes the first x number of paragraph tags would be something I need. I'll look more into XSLT as that's also something new to me.
Yes, it should pick up posts from all 6 blogs. But if one blog has all the 6 newest entries, then those 6 will be displayed. So if you want one from each, then you need to change the logic.
Displaying Excerpts and a multiblog page with Blog4Umbraco
Hi All,
I'm new to Umbraco but so far it seems to be heads and shoulders above anything I've ever used. I couldn't find a solution to this anywhere in the current forums. I am currently using it to move my company's network of 6 blogs onto our own server and off of blogger. I set up the blogs very easily with Blog4Umbraco but not have some questions about extending it.
The first is on each blog starting page, it displays the entirety of each post. I'd like it to show 12 lines or so for the most recent post and only about 5 lines for each the next few. I don't really know how to go about implementing this...any points in the right direction would be a hugeeeee help.
The second is a bit of a different issue with some similarities. I need a network homepage that displays most recent posts from all the blogs that are child nodes of the page. Also, like the first issue, this needs to display 12 lines or so from the most recent post and only 4 or 5 from the previous ones.
Thanks in advance for any help or clues as to solving this puzzle.
The excerpt of a post is a bit of a classic dilemma. There are a few ways of doing this sort of thing:
1: Add a new property on the blogpost type, to manually enter the excerpt.
2: Strip the html, and take the first x chars of the body text
3: Do some intelligent parsing of the post so you can f.ex. render the first three <p> sections of the post
4: Have the editor insert some sort of split identifier in the post. This might pa something like putting a class on a paragraph like <p class="split">. Then use this identifier to get the excerpt.
So what route you want to take is probably up to how your writers like to work, and how much you like manipulation strings :-) The main thing is to be aware not to cut off the body text's html in the middle of a paragraph or similar.
With regard to the network page, I guess that depends on your site structure. You will probably get a long way by just copying the standard list macro, and insert it on your top page, since it probably just looks for descendant blogposts. If your network page is a sibling to the blogs, then you might need to do a bit more work.
Hi,
There's an old post (http://forum.umbraco.org/yaf_postst5376_META-Description.aspx) that discusses stripping out the first xx characters in xslt. This should point you in the right direction.
I think you will benefit from reading up on xslt, a good startig point is http://umbraco.org/documentation/books/xslt-basics
All output of any Umbraco Data can be accomplished through xslt, this transforms the xml in data/umbraco.config into html.
Cheers,
Chris
Thanks for all your help and such a fast response.
"With regard to the network page, I guess that depends on your site structure. You will probably get a long way by just copying the standard list macro, and insert it on your top page, since it probably just looks for descendant blogposts. If your network page is a sibling to the blogs, then you might need to do a bit more work."
I thought there might be something like this...my main concern is that I want it to be the most recent posts from all 6 blogs combined. Is this still something that the standard list macro would be able to accomplish. All blogs are child nodes of the network page.
As far as the posts go, I agree that I need to be careful about not cutting posts in the middle of paragraphs or even words! I think maybe working it so it takes the first x number of paragraph tags would be something I need. I'll look more into XSLT as that's also something new to me.
Yes, it should pick up posts from all 6 blogs. But if one blog has all the 6 newest entries, then those 6 will be displayed. So if you want one from each, then you need to change the logic.
Thanks a lot. I'll give this all a shot. This has been hugely helpful.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.