Reputation: 3
I'm currently creating a CMS for a site in Adobe CQ5. One of the components that has been asked for is to have a custom navigation component for menus. The user would be able to enter a series of links and urls specific to that page.
The kicker is that they need to be able to share this menu with several other pages (but not all, generally this will be the other pages in the same folder). There will also be several different menus each shared between their own group of pages.
So I guess the question is, what is the simplest way to have one menu that is edited once and the changes reflect across multiple pages?
Upvotes: 0
Views: 2115
Reputation: 1
Create a page component where you can include your menu component by iparsys and inherit that page on your subpage(for specific template) component.when you will make any changes in menu component it will reflect to all pages.
Upvotes: 0
Reputation: 116
Another option is to make this component "inherit" from its parent. To do this you can add a checkbox to the dialog which will indicate if the component should or shouldn't inherit from its parent. If so your component code can crawl up the tree looking for a nav component on a parent page and load it if found. If not the component can just load the data from its current resource.
This will let you make any number of separate nav groups and allow the content authors to edit the navigation without having to go off to another config area, which can break the editing experience.
Upvotes: 0
Reputation: 9402
One option is to create a "data" component--that is, a component that is used to author data instances. Each data instance would contain the menu data and would allow an author to change the menu data. Then create a second component that is a consumer of the data--that is, a component that refers to an existing data component instance and renders the data. Then you can have as many pages as needed render the same menu data, and if the underlying menu data instance changes it will affect all pages.
You might consider structuring your "data" instances so they will be created in a separate content area that you may want to make viewable differently than normal content pages and that may have different authoring permissions if you need to control who can make changes to the menu. That will also make it easier to wire things up so authors can pick an existing data instance to use for their consumer component.
Upvotes: 0