I'm new to uBlogsy - is there an easy way to display just the latest blog post, on my home page?
I'm also assuming I can use uBlogsy on an existing Umbraco site, to show up as a regular page on my site. I saw another thread here "Easy way to integrate to an existing site" which seems to indicate that, but I haven't dug into it yet to figure out exactly how that works.
Yes you can integrate it into a site very easily. Just take a look at the base master pages. The only requirement is the landing node (and the posts node if you want to use the rss import).
As far as listing the latest blogs, the rip some code out of uBlogsyListPosts.cshtml, or you can call the macro with ItemCount=1
I'm trying to pull the most recent stories onto my hompage as well. I had it set up with Blog4Umbraco like this:
And would love to get the same result from UBlogsy.. I've tried using <umbraco:Macro ID="Macro2" Alias="uBlogsyListPosts" ItemCount="1" Small="0" runat="server" /> as mentioned by Anthony but it doesn't seem to generate any results for me..
@Anthony, is that something that works in v1.32? I see that v.1.33 is out.. but I haven't updated to it yet.
Yeah that helped some.. I can now see the title "Latest Posts" but no stories show up with it.. I know I made some modifications when I was creating my own paging solution so if you wouldn't mid look at the code below to see if I have created a conflict I would apprecaite it:
Anthony, you said: "Yes you can integrate it into a site very easily. Just take a look at the base master pages. The only requirement is the landing node (and the posts node if you want to use the rss import). "
Can you give me a little more detail about what to do? I've looked at the master pages, but I'm kind of new to Umbraco.
I'm still at the same point as [tesuji] any chance you could provide a sample macro that we could use since we both seem to have the blog as sub-section to our sites.
I assume I just need to make a new macro and modify the call that looks for current/decendent to the specific nodeID of my uBlogsy blog.. but I haven't been able to get it to work so far.. Thanks!
// get all posts IEnumerable<DynamicNode> postList = new DynamicNode(<ID OF UBLOGSY LANDING NODE>) .DescendantsOrSelf("uBlogsyPost") .Items .Where(x => x.GetProperty("umbracoNaviHide").Value != "1");
Sorry to bump old thread, but I am trying to do this today!
When I call the Macro, it literally just displays the H2 tagged Latest Posts line, and that is it. Then under that is the ID of the blog im trying to show as I have called it out too.
Is there a way to do this while still keeping the "blog" oustide of the root of the site? How would you go about rendering the blog content in another template that matched the site?
I have one uBlogsy Blog which has several categories, each corresponding to a "site". So there's category 1 which the user will tag if they want the blog post to appear on site one, etc. I have no problem getting the list of latest posts, posts by tags, etc into any of my sites via a razor macro. My challenge is that each of the sites have a different master template and I'm not sure how to keep the link to the full blog post within the site that the abstract is posted on via a razor macro...and have it render inside a template appropriate to that site.
Show latest blog post on home page?
I'm new to uBlogsy - is there an easy way to display just the latest blog post, on my home page?
I'm also assuming I can use uBlogsy on an existing Umbraco site, to show up as a regular page on my site. I saw another thread here "Easy way to integrate to an existing site" which seems to indicate that, but I haven't dug into it yet to figure out exactly how that works.
Hi
Yes you can integrate it into a site very easily. Just take a look at the base master pages. The only requirement is the landing node (and the posts node if you want to use the rss import).
As far as listing the latest blogs, the rip some code out of uBlogsyListPosts.cshtml, or you can call the macro with ItemCount=1
<umbraco:Macro ID="Macro2" Alias="uBlogsyListPosts" ItemCount="1" Small="0" runat="server" />
Hey Guys,
I'm trying to pull the most recent stories onto my hompage as well. I had it set up with Blog4Umbraco like this:
And would love to get the same result from UBlogsy.. I've tried using <umbraco:Macro ID="Macro2" Alias="uBlogsyListPosts" ItemCount="1" Small="0" runat="server" /> as mentioned by Anthony but it doesn't seem to generate any results for me..
@Anthony, is that something that works in v1.32? I see that v.1.33 is out.. but I haven't updated to it yet.
I noticed Small=0 in yoru macro call. Make it small=1
<umbraco:Macro Alias="uBlogsyListPosts" ItemCount="5" Small="1" runat="server" />
If you want custom html for it you'll have to copy the script and create a new macro.
Hi Anthony,
Yeah that helped some.. I can now see the title "Latest Posts" but no stories show up with it..
I know I made some modifications when I was creating my own paging solution so if you wouldn't mid look at the code below to see if I have created a conflict I would apprecaite it:
Thats what my uBlogsyListPosts.cshtml file looks like at the moment..
Hard to tell
You should debug it by deleting things until it works.
Start with everything in your "else"
Anthony, you said: "Yes you can integrate it into a site very easily. Just take a look at the base master pages. The only requirement is the landing node (and the posts node if you want to use the rss import). "
Can you give me a little more detail about what to do? I've looked at the master pages, but I'm kind of new to Umbraco.
I don't need the RSS import, by the way
uBlogsyBaseSite has the <html> dec. You should make that masterpage inherit from YOUR masterpage which has <html>
I think your best bet is to look into masterpage tutorials: http://www.asp.net/master-pages/tutorials
I put the following in my home page master template to show the latest post only, but it doesn't show the post.
<umbraco:Macro Alias="uBlogsyListPosts" ItemCount="1" Small="1" runat="server" />
Looking at the output in browser View Source, it only shows the following:
<div class="uBlogsy_posts_container uBlogsy_bottom_border">
<h2>
Latest posts</h2>
<ul>
</ul>
</div>
My main blog page works fine - it lists several posts.
This will happen if you do not have the ublogsy landing node under the node(page) you're trying to use the macro on.
eg.
Content
- Home
- Blog
The script relies on the fact that it is being used on either the uBlogsy Landing page, or a descendent of the landing page.
If this is the case then you need to modify the macro script to get the ublogsy landing node.
If this is not the case, can you copy and paste your content tree here.
Hi Anthony,
I'm still at the same point as [tesuji] any chance you could provide a sample macro that we could use since we both seem to have the blog as sub-section to our sites.
I assume I just need to make a new macro and modify the call that looks for current/decendent to the specific nodeID of my uBlogsy blog.. but I haven't been able to get it to work so far..
Thanks!
guys this is how you do it:
// get all posts
IEnumerable<DynamicNode> postList = new DynamicNode(<ID OF UBLOGSY LANDING NODE>)
.DescendantsOrSelf("uBlogsyPost")
.Items
.Where(x => x.GetProperty("umbracoNaviHide").Value != "1");
List<DynamicNode> nodes = postList.OrderByDescending(x => x.GetProperty("uBlogsyPostDate").Value)
.Take(10)
.ToList();
<div class="uBlogsy_posts_container uBlogsy_bottom_border">
<h2>
Latest posts</h2>
<ul>
@foreach (DynamicNode n in nodes)
{
<li>
<a href="@n.Url">
<span>@n.GetProperty("uBlogsyContentTitle").Value</span>
</a>
@* - <span>@n.GetProperty("uBlogsyPostDate").Value.FormatDateTimeOrdinal("d MMMM yyyy")</span>*@
</li>
}
</ul>
</div>
Sorry to bump old thread, but I am trying to do this today!
When I call the Macro, it literally just displays the H2 tagged Latest Posts line, and that is it. Then under that is the ID of the blog im trying to show as I have called it out too.
Any help please?
Is the ublogsy landing node not under the home page node?
If so, then you will have to either hardcode it's id in the macro script, or do a search for it.
I have put the uBlogsy blog under the home node in my content tree, if that is what you mean?
Sorry my mistake
The macro script won't work unless you're running it from the landing node, no matter where that is.
Easiest fix is to hardcode it's id in the macro script.
Does all this still hold for uBlogsy 2.1? If not, please tell me how to do it.
yes
I got the following to work. It shows the first three blog items on the home page.
I put this into a new .cshtml file in the Developer -> Scripting Files folder in Umbraco, and they wrapped it in a macro.
@using System.Linq
@using System.Xml.Linq
@using umbraco.MacroEngines
@using uBlogsy.Common.Extensions
@using uBlogsy.Common.Helpers
@using uBlogsy.BusinessLogic
@{
// get all posts
IEnumerable<DynamicNode> postList = new DynamicNode(1083)
.DescendantsOrSelf("uBlogsyPost")
.Items
.Where(x => x.GetProperty("umbracoNaviHide").Value != "1");
List<DynamicNode> nodes = postList.OrderByDescending(x => x.GetProperty("uBlogsyPostDate").Value)
.Take(3)
.ToList();
<div class="uBlogsy_posts_container uBlogsy_bottom_border">
<h2>
Latest posts</h2>
<ul>
@foreach (DynamicNode n in nodes)
{
<li style="list-style: none;">
<span>@n.GetProperty("uBlogsyPostDate").Value.FormatDateTimeOrdinal("d MMMM yyyy")</span>
<br>
<a href="@n.Url">
<span>@n.GetProperty("uBlogsyContentTitle").Value</span>
</a>
<br>
@Truncate(umbraco.library.RenderMacroContent(n.GetProperty("uBlogsyContentBody").Value, n.Id), 500)
<a href="@n.Url">Read More</a>
</li>
}
</ul>
</div>
}
@helper Truncate(string input,int length)
{
if(input.Length <= length){
@Html.Raw(input)
} else {
@Html.Raw(input.Substring(0,length))<text>...</text>
}
}
Is there a way to do this while still keeping the "blog" oustide of the root of the site? How would you go about rendering the blog content in another template that matched the site?
Amir can you explain more what you're trying to do? I'm not sure I understand.
A picture of your content tree would help too.
Hi Anthony, here's the setup.
I have one uBlogsy Blog which has several categories, each corresponding to a "site". So there's category 1 which the user will tag if they want the blog post to appear on site one, etc. I have no problem getting the list of latest posts, posts by tags, etc into any of my sites via a razor macro. My challenge is that each of the sites have a different master template and I'm not sure how to keep the link to the full blog post within the site that the abstract is posted on via a razor macro...and have it render inside a template appropriate to that site.
Here the content tree:
is working on a reply...