Page tree and Asset tree are kept separate and that’s definitely a good thing. It’s totally up to the editor on how to structure both pages and folders.

However in big sites that may soon become problematic simply because pages are strictly dependant on the files that are displayed in its body. It’s very important to make the files easy to find and reuse later on.

Imagine that you’re builing a site with several sections and you want to upload specific image logos to each of the sections. The “For This Page” folder cannot be shared across several pages, like section and all of descendant pages. It could be used for one specific page instance, so it’s not a solution in that case.

You would probably create sections as child nodes to your Home Page and similarly create a folder for each section in the Assets Tree. Similar structure is used on Alloy demo site.

Assets folder relations

Later on you would probably figure out that you should let ContentEvents do that synchronization for you to always create a folder whenever you add a new section.

But what if your site contained thousands of sections?

In one of our projects that was actually the case and the customer found it extremely hard to find the files of their interest. He didn’t know the name of the file to look for, he simply knew that another division had probably put the file somewhere in one of the folders of their department section.

It was easy to find their department page but then, looking at the page tree to find the corresponding folder in the Asset pane.. was definitely not very user friendly…

We decided to help by introducing a permanent mapping between certain page types and their corresponding “Page Asset Libraries”. This is how it looks like for the editor:

greg_magic_button

When clicking the highlighted button the appropriate Section Folder is automatically selected in the Assets Pane (with all its ancestors). The customer liked it so much that they even gave this button a name – “the magic button” ; )

It required a few important steps to get it up and running.

1) Folder is created & holds corresponding Section Page reference.

Create a new folder in an appropriate tree node while creating a new section and store its ref in Section.ContentFolderReference property.

2) Section page holds corresponding Folder reference.

In addition you have to track & maintain all possible changes (rename, delete etc…).

3) UI element to preselect the folder

Last but not least… you need a way to trigger this action through the UI.

First you have to declare a dojo command:

Then you need to add a command provider:

And finally the trickiest part that actually does all the magic: