Model.Content is never null

Topics: Troubleshooting, Writing themes
Feb 18, 2013 at 3:15 AM
Hello -

I am trying to create a home page that has a different layout than the rest of the site. Easy enough if I could just get Model.Content to be null. I created a Page and set it as the home page. I went to TheHomePage layer and made sure that no widgets were enabled in the Content zone. I assumed this would make Model.Content equal to null. The content markup is rendering regardless. I even tried to create a new content type without including body in the Parts. I am totally at a loss here and must admit feeling pretty dumb :)

layout.cshtml
@if (Model.Content != null)
{
<div id="layout-content" class="group">
    <div id="content" class="group">
        @Zone(Model.Content)
    </div>
</div>
}

Thank you for the help,

Jordan
Coordinator
Feb 18, 2013 at 6:30 AM
Why don't you enable url alternates and create layout-url-homepage.cshtml?
Feb 18, 2013 at 8:28 AM
Try:

@if (HasText(Model.Content))
Feb 18, 2013 at 12:53 PM
Edited Feb 18, 2013 at 12:56 PM
I will take a look at the URL alternates. Is there a web site resource you would recommend?

Thanks,

Jordan
Feb 18, 2013 at 12:57 PM
HasText()... duh :) Ill give that one a go. I think I may still run into some meta tag info issues but i'll check those out as well.
Feb 19, 2013 at 3:01 AM
Apparently it has text and I have been struggling to get multiple layouts to work.
Coordinator
Feb 19, 2013 at 4:17 AM
I'll repeat my question: "Why don't you enable url alternates and create layout-url-homepage.cshtml?"
Feb 20, 2013 at 1:45 AM
I do not know how to do that. That would be ideal. I have tried a couple of methods I found but have not been able to get them to work. Do you have a good reference you would recommend?

Jordan

On Feb 18, 2013, at 10:17 PM, "bertrandleroy" <notifications@codeplex.com> wrote:

From: bertrandleroy

I'll repeat my question: "Why don't you enable url alternates and create layout-url-homepage.cshtml?"
Feb 20, 2013 at 7:57 PM
Just to be sure: you don't know how to enable the Url Alternates feature, or you do but it does not work?
Coordinator
Feb 21, 2013 at 1:18 AM
Go to "modules" in the admin, look for url alternates, and enable it. Then create a template called layout-url-homepage.cshtml under the views folder of your theme. I don't know why you'd need a reference, or a reference of what. Maybe this? http://docs.orchardproject.net/Documentation/Alternates
Feb 21, 2013 at 4:27 AM
Not sure how to do it. I played with some module for it but it didn't work out. I also tinkered with some other class but that didn't turn out well either.

Thanks

Jordan

Sent from my iPhone

On Feb 20, 2013, at 1:57 PM, "sfmskywalker" <notifications@codeplex.com> wrote:

From: sfmskywalker

Just to be sure: you don't know how to enable the Url Alternates feature, or you do but it does not work?
Feb 21, 2013 at 4:27 AM
I give this a try tomorrow. Thanks for all of your guidance on this.

Sent from my iPhone

On Feb 20, 2013, at 7:18 PM, "BertrandLeRoy" <notifications@codeplex.com> wrote:

From: BertrandLeRoy

Go to "modules" in the admin, look for url alternates, and enable it. Then create a template called layout-url-homepage.cshtml under the views folder of your theme. I don't know why you'd need a reference, or a reference of what. Maybe this? http://docs.orchardproject.net/Documentation/Alternates
Feb 22, 2013 at 4:06 AM
That was ridiculously easy. Thank you BertrandLeRoy.



On Wed, Feb 20, 2013 at 10:27 PM, Jordan Papaleo <papaleobus@gmail.com> wrote:
I give this a try tomorrow. Thanks for all of your guidance on this.

Sent from my iPhone

On Feb 20, 2013, at 7:18 PM, "BertrandLeRoy" <notifications@codeplex.com> wrote:

From: BertrandLeRoy

Go to "modules" in the admin, look for url alternates, and enable it. Then create a template called layout-url-homepage.cshtml under the views folder of your theme. I don't know why you'd need a reference, or a reference of what. Maybe this? http://docs.orchardproject.net/Documentation/Alternates

Read the full discussion online.

To add a post to this discussion, reply to this email (orchard@discussions.codeplex.com)

To start a new discussion for this project, email orchard@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com