简体   繁体   English

在Adobe CQ5页面之间共享内容

[英]Sharing content between Adobe CQ5 pages

I'm currently creating a CMS for a site in Adobe CQ5. 我目前正在为Adobe CQ5中的网站创建CMS。 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. 用户将能够输入特定于该页面的一系列链接和URL。

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? 所以我想问题是,一次菜单被编辑一次并且更改反映在多个页面上的最简单方法是什么?

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. 这也将使连接起来更加容易,以便作者可以选择一个现有的数据实例以供其消费者组件使用。

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. 这样一来,您可以创建任意数量的独立导航组,并允许内容作者编辑导航而无需转到另一个配置区域,这可能会破坏编辑体验。

创建一个页面组件,您可以在其中包含iparsys的菜单组件,并在子页面(用于特定模板)组件上继承该页面。当您对菜单组件进行任何更改时,它将反映到所有页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM