Blog post - add hyperlink back to Blog list

Topics: Customizing Orchard
Mar 31, 2014 at 12:29 AM
Edited Mar 31, 2014 at 12:39 AM
Hi,

Is there a simple way using the overrided view/shape Content-BlogPost.cshtml to add a hyperlink at the bottom of the post that routes back to the blog list page.

So you can click through to a blog post and have a link back to the list

When I add custom code to Content-BlogPost.cshtml it also shows up on the blog list page as well. I have also overrided that shape with Parts.Blogs.BlogPost.List.cshtml but it seems Content-BlogPost.cshtml affects both the list and the bolg post?


Is this possible using the code below?

@using Orchard.Utility.Extensions;
@{
if (Model.Title != null) {
    Layout.Title = Model.Title;
}

Model.Classes.Add("content-item");

var contentTypeClassName = ((string)Model.ContentItem.ContentType).HtmlClassify();
Model.Classes.Add(contentTypeClassName);

var tag = Tag(Model, "article");
}
@tag.StartElement
<header>
    @Display(Model.Header)
    @if (Model.Meta != null) {
        <div class="metadata">
            @Display(Model.Meta)
        </div>
    }
</header>
@Display(Model.Content)
@if(Model.Footer != null) {
    <footer>
        @Display(Model.Footer)
    </footer>
}
@tag.EndElement
Developer
Mar 31, 2014 at 11:32 PM
Create an alternate called Content-BlogPost.Detail.cshtml - That way it wont show in the List.

FYI: The list view shows the Summary view of the BlogPost, not the Detail view.
Apr 10, 2014 at 3:04 PM
thanks all fixed using that alternate