Building a blog

Topics: Writing themes
Aug 31, 2011 at 4:56 PM
Edited Aug 31, 2011 at 5:04 PM

Hello. I'm learning the Orchard theming process and I'm a little stuck.

In particular, I need information about the rendering of a blog post. These are my questions:

1) The file is used only to define where the elements have to be placed? Or is it used also to define what elements to place and where?

2) Studying the default theme, I've figured out how the zones are structured and defined. Then, using the Shape Tracing tool I have created an alternate View for the blog post. The problem is in my generated code:


@using Orchard.Utility.Extensions;
    if (Model.Title != null) {
        Layout.Title = Model.Title;
    var contentTypeClassName = ((string)Model.ContentItem.ContentType).HtmlClassify();
<article class="content-item @contentTypeClassName">
        @if (Model.Meta != null) {
        <div class="metadata">
    @if(Model.Footer != null) {


Here is not clear how to dissect my blog post content (title, content, comments, etc.). I only want to be able to put the title under a H1, the content under a paragraph, etc. Why is it so complicated?

Thank you.


#EDIT - More details:

The problem is that Model.Content keeps all the data I want to split! What I need is something like Model.Content.Title or Model.Content.Body and so on :-)

Aug 31, 2011 at 6:55 PM
Edited Aug 31, 2011 at 6:56 PM

1. What and where. You can make a part disappear by sending it to "-", and a part won't appear until there is a placement file somewhere that includes itinto a local zone.

2. What you see in the content template is just the definition of local zones, where placement is going to dispatch shapes. To override the rendering of specific shapes, you have to override the templates for those shapes.

It is designed this way so that many modules can contribute to the rendering without stepping on each other's toes.

If you find templates + placement too hard, you can actually do away with placement and render each part or even each property explicitly from the content template:

Also, shape tracing is your friend.

Sep 1, 2011 at 9:44 AM

Ok. Thank you for your answer.

I can understand: there are certainly good reasons why Orchard is designed this way and one day I will understand all of them :-)

For now, let's talk a little about this blog post rendering. So, I have a basic Orchard installation with the Blog recipe and the default theme. 

1. I create some posts.

2. They are correctly listed in the /blog section of my site.

3. Now, I'd like to style/position/render them as I want.

4. Ok, I rewrite the Content-Blog.cshtml view with Shape Tracing tool.

5. Great. Now I can rewrite the output of every element in the loop of the posts!

6. All I wanna do, now, is structuring my post. Using template overriding? Sure. Using Why not? I don't care, since I can't do it in any way, so I can't decide what's better! :-)

Excuse me my talking style, but really, I'm going crazy. On this message board, at least 50 people asked my same question, but nobody seems to be understanding the real problem and so there are no answers. I think there is a curse or something about it.

Sep 1, 2011 at 11:27 AM

Ok. Maybe I'm understanding. Please, ignore my previous post. I'm definitely going to write some tutorials to help others like me bearing with frustration :-)

Sep 1, 2011 at 6:21 PM

I'm sincerely sorry about the frustration. Orchard is certainly not perfect, and I understand it can be a little overwhelming. I am myself sometimes frustrated that we can't go faster and make a few things easier (placement is one: that it is XML was never meant to be our final word, but we haven't had time to revisit it and provide an easier way to do it). If you can write tutorials on your experience, good and bad, and on how you overcame difficulties, that would indeed be the best way to make the best out of it and help others along the way. :)

Sep 1, 2011 at 11:39 PM

The problem could be in my poor skills, so don't worry about my own frustration! :-)

However, if a problem does exist, I think it is in the documentation. Perhaps not too much user friendly or not helping a lot who is switching to Orchard from another CMS/platform.

Apart from that, you are doing a wonderful job and I really hope to be able to write something to help growing the community!

Sep 2, 2011 at 12:39 AM