This project is read-only.

Widgets, Zones, and URL Alternates

Topics: Customizing Orchard, Writing themes
Nov 9, 2014 at 5:35 PM
I'm writing a theme (and modules) to display all manner of custom parts and custom types I've created. I'm using URL Alternates to provide specific renderings of the homepage and other sections that help facilitate navigation to my content.

The problem I'm struggling with, at the moment, is writing widgets to show "live" content on my homepage. I have my alternate homepage set up and have static content there now, but I want to show widgets (only on this page and potentially other select pages) that show live content, similar to RecentBlogPosts. I don't want this widget to show up on other content pages.

So I've created a widget that queries and renders the data I want, and created a zone in my theme.txt, and everything renders fine. The problem is, ideally I'd be able to define the Zone in my alternate, but Orchard only renders widgets to top-level, Layout-defined zones.

I know that Zones are really just shapes and that I can use to render data to a local zone, but I don't know how to make Orchard catalyze the widget in question in my alternate homepage.

Am I approaching the problem wrong or not creating a theme in the way Orchard expects? If so, how should I approach things? Should I be using AJAX and create a controller instead to render my data?
Nov 9, 2014 at 11:10 PM
Edited Nov 9, 2014 at 11:11 PM
I'm not sure I see the issue. You have a widget, a TheHomepage layer, and a Layout shape alternate for the homepage. It seems that all you need to do in your homepage specific layout template is render your zone.
Nov 9, 2014 at 11:31 PM
I did not have a layout shape alternate or even realize you could have layout shape alternates. That's the ticket! Thanks Sipke!