I'm new to Orchard and have watched both the Pluralsight "Orchard Fundamentals" and "Advanced Orchard" tutorials. Its a great platform, but I'm having a hard time wrapping my head around a couple of things.
I'd like to create a blog showcase banner on the home page only that rotates blog posts on the site. I have the HTML sliced up and functioning on an HTML template. The banner looks like this:
http://arerra.com/news-slideshow.jpg
So far I have done the following:
I've created a Blog called "Articles" and have placed a single post in there for testing.
Added a Layer called "ArticleList" where I have placed a Widget for "Recent Blog Posts"
I've created a custom layout for the home page called "Layout-Url-HomePage.cshtml" in my theme.
In my Theme "Views" folder, I have created a file called "Widget.Wrapper.cshtml" with only
@Display(Model.Child)
in it to remove the<article><header/><footer /><article>
tags globally from the widgets.Added a file in "Views > Parts > Blogs.RecentBlogPosts.cshtml" to control the layout of my shape. The code is the following:
@using Orchard.ContentManagement; @{ IEnumerable<object> blogPosts = Model.ContentItems.ContentItems; } @if (blogPosts != null) { <div class="container news-slider"> <ul class="slide-images"> @foreach (dynamic post in blogPosts) { string title = post.Title; ContentItem item = post.ContentItem; <img src="/Themes/MountainWestHoops/Content/img/placeholder-700x380.jpg" alt="@title" class="active" /> } </ul> @foreach (dynamic post in blogPosts) { string title = post.Title; string body = post.Body; ContentItem item = post.ContentItem; <div class="featured-story threeD active"> <h1>@title</h1> <p>@body @Html.ItemDisplayLink("READ MORE", item)</p> </div> } <aside> <ul class="tabs"> @foreach (dynamic post in blogPosts) { string title = post.Title; string url = post.Url; ContentItem item = post.ContentItem; <li><a href="@url"><h3>@title</h3></a></li> } </ul> <div class="ad-three-day-trial"> <a href=""><img src="/Themes/Content/img/placeholder-260x190.gif" /></a> </div> </aside> </div> }
My HTML is rendering properly, but none of the values that I have specified are showing up.
I am using the "Shape Tracer" module to see what template is being used. What is funny, is that the @Html.ItemDisplayLink("READ MORE", item) is rendering the article's URL, and if I replace the "READ MORE" with the string title, the title renders properly.
What am I doing wrong here that is causing strings to not display? Am I missing a larger point and misunderstanding the fundamentals? The tutorials seems to say that you can simply move around parts, but in this case, I need to have very specific markup for this slider to work.