Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Same Page Under Different Menu

Avatar

Level 2

Hi,

I need to create a page which comes under different menus without duplication of that page. I googled about taxonomy but i don't think its not related to my requirements.

Eg: Menu -->

                Sub Menu1 --> Page1 (same page)

                Sub Menu 2 --> Page1 (same page)

                Sub menu 3 -- > Page 3

Can anyone please give some suggestion on this . Thanks in advance.

Thanks,

Mohamedh Nishadh

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

First of all, any answer to this question isn't easy, because the answer has implications in the way how you structure your website. I really recommend you to get in touch with someone how's already done that.

Then, the standard way to build a navigation is just by structuring the pages into hierarchies. The pages on the top level become the menu items, and the pages beneath these top level pages become the sub-items. This approach is recommended by Adobe and also implemented for example in Geometrixx. It has a number of pros and cons:

  • You don't need to maintain a navigation structure manually; if you place a page on the site at the right place, it will appear in the navigation immediately.
  • A website is always structured in a hierarchical way, and this approach is reflected by the JCR page tree, and the URL namespaces.
  • Therefor each page "has its place", both from a hierarchy point of view, but also from a content point of view. Why do you want to appear the same page at 2 different places? What about SEO?

The negative aspect of this approach:

  • Your structure is rather static, because changes to the navigation means changes to the site structure means changes to URLs. And that's something you'd like to avoid.

 

So, it looks like that this approach isn't the right match. But your requirement doesn't make sense to me. If a page appears on multiple locations in the navigation, the content doesn't really fit. I also don't get your example about the laptop page being displayed both under "computers" and "electronic gadgets". Do you really want display the same content in both places.

So, please get in touch with someone experienced in that domain. I don't recommend another approach, because in the long term they cause problems as well (normally bigger ones).

kind regards,
Jörg

View solution in original post

10 Replies

Avatar

Employee Advisor

Hi,

So with "different menus" you mean the menu (navigation) on your pages? So does this also mean, that your navigation does not necessarily reflect the page structure?

If that's a In that case I would suggest to create something (preferably a node structure, one item is reflected by a node), which reflects your navigation; and inside this node structure link the items in the menu with the pages on your site. Of course this has to be completely changeable by authors :-) Of course that's the generic and most flexible solutions, and there are possibly lots of ways to achieve the same with different approaches, maybe even with less effort.

kind regards,
Jörg

Avatar

Level 2

And i found an option copy page properties in sidekick . Its creating same page to new location . But when i change the content in original page. It's not reflecting in copied page.

Avatar

Level 10

From the menu - simply link to the CQ web page.

Tags  will not help you build menus that pull up CQ web pages. 

If you want to build menus in CQ pages - look at using JQuery plugins - such as:

http://www.smartmenus.org/

Avatar

Level 2
Hi mac,
 
These menus are dynamic ones so i can't link it to the pages as you mentioned. I think you misunderstood my requirements . I need to have page like Lenovo Laptop under menu category like Laptos and Electronic Gadgets both are different menu but the page content is same. So i don't want to create two different pages under both menus. I will create a single page called lenovo laptop under single menu and it should also comes under other menu too. If i change the content in single page it should reflect to other page too. 
 
Thanks a lot for you response.

Avatar

Level 2

Hi jorg,

Thanks for your response. Can you please explain little bit elaborately. Am newbie to this domain.

Yes i meant navigation. Can you please go through the my reply to  mac. I have clearly mentioned my requirement on that reply. I really appreciate your effort.

Avatar

Level 10

Look at the navigation component and how to build it in this AEM topic:

http://docs.adobe.com/docs/en/aem/6-0/develop/the-basics/website.html

To achieve your results - you will have to code the logic in your Navigation component. As Joerg points out - since you are not following the code structure - you need to develop app logic which reflects your navigation.

Here is the code for the nav component in the article. You need to modify this to reflect your nav requirements. 

 <%@include file="/libs/foundation/global.jsp"%><%
%><%@ page import="java.util.Iterator,
        com.day.text.Text, 
        com.day.cq.wcm.api.PageFilter, com.day.cq.wcm.api.Page" %><%
    /* get starting point of navigation */
    Page navRootPage = currentPage.getAbsoluteParent(2); 
    if (navRootPage == null && currentPage != null) { 
    navRootPage = currentPage; 
    }
    if (navRootPage != null) { 
        Iterator<Page> children = navRootPage.listChildren(new PageFilter(request));
        while (children.hasNext()) { 
            Page child = children.next(); 
            %><a href="<%= child.getPath() %>.html"><%=child.getTitle() %></a><%
        } 
    } 
%>

Avatar

Correct answer by
Employee Advisor

Hi,

First of all, any answer to this question isn't easy, because the answer has implications in the way how you structure your website. I really recommend you to get in touch with someone how's already done that.

Then, the standard way to build a navigation is just by structuring the pages into hierarchies. The pages on the top level become the menu items, and the pages beneath these top level pages become the sub-items. This approach is recommended by Adobe and also implemented for example in Geometrixx. It has a number of pros and cons:

  • You don't need to maintain a navigation structure manually; if you place a page on the site at the right place, it will appear in the navigation immediately.
  • A website is always structured in a hierarchical way, and this approach is reflected by the JCR page tree, and the URL namespaces.
  • Therefor each page "has its place", both from a hierarchy point of view, but also from a content point of view. Why do you want to appear the same page at 2 different places? What about SEO?

The negative aspect of this approach:

  • Your structure is rather static, because changes to the navigation means changes to the site structure means changes to URLs. And that's something you'd like to avoid.

 

So, it looks like that this approach isn't the right match. But your requirement doesn't make sense to me. If a page appears on multiple locations in the navigation, the content doesn't really fit. I also don't get your example about the laptop page being displayed both under "computers" and "electronic gadgets". Do you really want display the same content in both places.

So, please get in touch with someone experienced in that domain. I don't recommend another approach, because in the long term they cause problems as well (normally bigger ones).

kind regards,
Jörg

Avatar

Level 2

Thanks for your reply jorg. And for your question, yes the content for the both pages are same which comes under the category computers and electronic gadgets.

For that particular reason only. I don't need to have different pages, and if we have two pages (not  two pages, may be we will have multiple pages)  we need to change each page content manually at the time of authoring mode.

This is what my total concern about the issue.

Thanks, 

Moahmedh Nishadh

Avatar

Employee Advisor

Hi Moahmedh,

still, the question remains hard. And still my recommendation holds true: get in touch with someone who already has gained experience in that area. This topic might start small, but if you start to allow this, you open a can of worms ...

What you could do is a kind of middle-thing between. First, give this page a home and put it somewhere in your content tree, where it makes most sense. And then implement a traditional navigation component, which is based on the page hierarchy in the repository. At the location, where this has to occurr a second time, create a "proxy page", which links to page you want to have two times in the navigation. And then enhance your navigation component to deal with this proxy page. Instead of reading all information from the proxy page (and traversing down the tree to build any kind of sub menu) it just goes over to the linked page, reads the properties from there and also gets any children from there.

I can imagine, that this might work. You add a bit of complexity to your navigation, but you don't have to maintain any copies of the page.

kind regards,
Jörg

Avatar

Level 2

I think this will help. The term "proxy page " is new to me .Let me analyze this and will try to implement your recommendation. Thanks a lot.