I am trying to display the related posts under my current post instead of having them over on the right hand column.. I am trying to tweak the uBlogsyShowPost.cshtml file in order to do so. I have included the code at the bottom of this file and shown where I would like to be able to display the related posts.
I've been looking at the code located in the uBlogsyListRelatedPosts.cshtml file but haven't been able to successfully move it over and incorporate it into my uBlogsyPost display.
Could you possibly show me the bit of code I need to include here to make the related posts show up?
The issue is that the script needs parameters. eg. @Parameter.ItemCount. So you cant simply include the script or copy and paste the code. You have to do a check for the parameters.
This is what you want in the top of uBlogsyListRelatedPosts.cshtml
int count;
string relatedAlias;
int matchCount;
if (PageData.Count > 0){
count = PageData[0];
relatedAlias = PageData[1];
matchCount = PageData[2];
}
else{
// get item count
count = int.Parse(@Parameter.ItemCount);
// can be uBlogsyPostTags, uBlogsyPostCategories, or empty string (gets both)
relatedAlias = @Parameter.RelatedAlias;
// get number of items to match
matchCount = int.Parse(@Parameter.MatchCount);
}
if (count == -1)
{
count = int.MaxValue;
}
// get all posts
DynamicNodeList postList = Model.AncestorOrSelf(1).DescendantsOrSelf("uBlogsyPost");
This is the new line you want in uBlogsyShowPost. Tweak the parameters as required.
Move "Related Posts" under Current post
Hello Anthony,
I am trying to display the related posts under my current post instead of having them over on the right hand column.. I am trying to tweak the uBlogsyShowPost.cshtml file in order to do so. I have included the code at the bottom of this file and shown where I would like to be able to display the related posts.
I've been looking at the code located in the uBlogsyListRelatedPosts.cshtml file but haven't been able to successfully move it over and incorporate it into my uBlogsyPost display.
Could you possibly show me the bit of code I need to include here to make the related posts show up?
Thank you...
The issue is that the script needs parameters. eg. @Parameter.ItemCount. So you cant simply include the script or copy and paste the code. You have to do a check for the parameters.
This is what you want in the top of uBlogsyListRelatedPosts.cshtml
This is the new line you want in uBlogsyShowPost. Tweak the parameters as required.
Ah... Thanks.. works great.
is working on a reply...