Page Tree View

Topics: Core, Customizing Orchard
Jul 4, 2012 at 3:42 PM

I work for a web development company and I am currently evaluating Orchard for use on our various client projects. I like a lot of the features in Orchard but there is one issue that really bothers me and that is the way that pages are managed.

First off, there seems to be no child/parent relationship between pages. Pages can have a url structure that makes them appear to be related and I played around with a menu plugin that related pages with dot delimited orders (2 is the parent of 2.1 and 2.2). 

Secondly, and this relies on the first, pages are displayed in a list rather than a tree view that would represent their hierarchy.

Is there a way to create a hard parent/child relationship between two pages? It seems like this may be the way to go (http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations). Is that the way to do it? I guess I would create a "parent" field that is a dropdown that is populated with content items of type page.

Is there a way to make a custom admin view that I could use to display pages in a tree view? How hard do you think this would be?

Coordinator
Jul 5, 2012 at 2:20 AM

That's not exactly true. What's true is that the core Orchard makes no assumption about the way you want to structure your contents. That makes it possible to apply many different patterns rather than impose a pre-defined one on everyone. Examples include the Container/Contained parts, URL structure as you mention (but that comes from a module, not from the core), or Taxonomies. You can also combine some of these approaches. My personal preference goes to Taxonomies but it may not be what works best for you.

What you seem to be asking for is Container/Contained parts. You can add those to the Page content type. As for creating a treeview-based admin experience, that can absolutely be built, but to my knowledge nobody has done it yet. I personally dislike treeview experiences in CMS after having built one more than ten years ago but eh, one size does not fit all.

Jul 5, 2012 at 11:31 AM

Thanks for your response. I understand and appreciate that approach, but I feel that if the system comes with predefined content types then it is already making assumptions about the structure of your content. Pages are more often than not hierarchical in nature whether they be organized in a graph or a tree. I feel that it would be beneficial to provide an admin layout for displaying hierarchical data in a visual hierarchy.

Do you have any pointers on where to start with creating a custom admin view?

Jul 5, 2012 at 11:38 AM

I followed your advice and used Container/Contained. Is there no way in the backend to see what pages a page contains?

Developer
Jul 5, 2012 at 1:17 PM

You should try the latest version of the Navigation Module on the 1.x branch of the source code.

You could have a hierarchical list of menu elements.

It also provides some useful Widgets to put on the Front like Breadcrumbs or Menu.

Jul 5, 2012 at 1:36 PM

Is it called Navigation Module? I don't see it in the Gallery.

Developer
Jul 5, 2012 at 3:35 PM

It is not is the gallery.

This a replacement of the Core Navigation module for the next version 1.5.

Currently, it is only available on the latest version of the source code, on the 1.x branch : http://orchard.codeplex.com/SourceControl/list/changesets

To use it, you must be able to install Orchard manually http://docs.orchardproject.net/Documentation/Manually-installing-Orchard-zip-file or retrieve the source code and configure Orchard (http://docs.orchardproject.net/Documentation/Setting-up-a-source-enlistment)

Coordinator
Jul 8, 2012 at 6:42 AM

"Pages are more often than not hierarchical in nature"

Actually no: pages, and other contents, are rarely hierarchical. When they are, the hierarchy is usually not deep. And when it is, taxonomies are a better solution because they allow for multiple classifications of the same contents. Furthermore, many usability studies have shown that treeviews are not well understood by most users. That's why Windows has been trying to hide the hierarchical nature of the file system and has attempted to show a small number of top level categories instead.

As for the few content types we have out of the box they are not imposing much: they are those that we determined were used in almost all web sites. They are also not a constraint as the type system is highly extensible.

If you want the admin to surface hierarchical contents, you will have to build that I'm afraid. I can remember getting this request maybe five times over the life of orchard by the way, which should tell you something about how much people really need that feature.

Of course I'm not denying that is what you need, just saying that the scenario is not as mainstream as you may think.

Jul 9, 2012 at 5:56 PM

I'm sure that both of us thinks that our viewpoint is more mainstream than it actually is. I discussed this topic with one of our UX professionals and a number of other people in the industry they confirmed my viewpoint. Maybe we are just using different terms in the end.

I'm not sure why you think pages aren't generally hierarchical. I would agree that most content isn't but any site with more than 5 pages generally starts having parent/child pages and these pages generally exist on one spot. When I say "pages" I mean the content items that make up your sitemap, not news articles and blog entries.

In the end all I am interested in is how to do things in orchard. I have pages using container/contained but I can't find a way to see what pages a container page contains. Is there a way to do this?

Is there a way to use queries/projections in the backend to create an admin view? What I was wanting to do was to create something similar to the blog section for certain content types and I was wondering if there was an easy way to do it through the UI or if that had to be custom written. It would be neat if you could create a new content type and select an option to have it show up in the admin menu and even to specify a view type for it.

I'm glad to see that some form of admin search is slated for 1.5. I was concerned about having a site with 300 news items and having to find them in the back-end. The only way I see now is to select "news" as the content type and then order alphanumerical and poke around in the pagination till you find what you are looking for. Is there a better way than that already or is the search made to address this?

Coordinator
Jul 11, 2012 at 2:09 PM

You should look at the code in the blog module or in the list module. There is working code in there that queries for the contained items of a given container.

You can create admin views any way you want, based on arbitrary queries on ContentManager. There are plenty of examples throughout the code. It has to be custom-written right now but one could build a module that leverages projections for that very easily.

You may be interested in the latest Vandelay.Industries source drop (http://vandelay.codeplex.com/SourceControl/list/changesets) that adds admin menu items for each content type.