This project is read-only.

Creating a Separate Homepage

Topics: General, Writing themes
Mar 22, 2011 at 9:57 AM

I'm slightly confused about how to do this with Orchard, having been through some documentation...

I need to create a separate homepage for a site that doesn't look like the regular pages. It needs 4 small areas of editable text on the site, unlike the normal page which has 1.

How do I do this? Do I use a separate content type (and if so, how do I then create the layout for a content type) or is there a way to override the layout (and perhaps use widgets).

Thanks in advance...

Mar 22, 2011 at 9:26 PM

In 1.1 you'll be able to do this out of the box using the Url Alternates feature but in the meantime you can do it this way:

Mar 23, 2011 at 3:59 AM
Edited Mar 23, 2011 at 4:02 AM

You can try my module:

Instead of giving you an override per type, you get a drop-down list when you're editing content, using the "Layout Selector" part. Your theme can populate the list of alternate layouts.

Hope it's useful :)

Mar 23, 2011 at 6:06 AM

Well done, Pete. :)

Mar 23, 2011 at 11:03 AM

Thanks for your help, guys.

Mar 23, 2011 at 11:57 AM

Can I ask one more question on this? Is there a way to change the layout and to remove the body of the page, so the user doing the editing only gets the two widgets?

Mar 23, 2011 at 4:17 PM
Edited Mar 23, 2011 at 4:23 PM

Right - I think I see what you're getting at now.

What you want to do is create a new Content Type, you can do this from the Dashboard menu. Call your type "PageWithTwoTextPanels" for instance. Now click "Add Parts" and add the following: Common, Routable, Menu. Note that we didn't add the Body part; so this type of content can be placed on a URL but won't have any defined body.

Now you can install the "HTML field" module. This will allow you to add any amount of custom fields to your new content type, so you can add one for each panel of text you need.

At this point I'm not sure the best way to get those fields into the page! But there will be certain templates you can override, and/or ways to push those field values into Zones. This is something I've been thinking about how  to do neatly in Orchard but haven't had time to properly look into yet. You could combine all this with one of the layout selection systems we described, so you can select different layouts for the different types or items of content you create. I'm sure there's an easy way to get those field values into the layout template, if I get chance later I'll look into it. But you can try searching for Orchard tutorials on Fields and how to use them.

You could achieve something with widgets instead, but I think due to way widgets and layers are applied site-wide, it would be very fiddly to do; you'd have to set up a new layer for each piece of content, then keep adding new widgets to fill the panels each time you made a new page - not a very nice UI!

The other route you could go down is building your own ContentPart that would give you editing experience you need, and use your Driver definition to push content into Zones (I've seen examples of how to do that already).


Mar 23, 2011 at 4:57 PM

thanks, randompete.

It sounds like a new Content Type might make some sense.