Foren

Add navigation menu and sitemap to theme

J G, geändert vor 7 Jahren.

Add navigation menu and sitemap to theme

Junior Member Beiträge: 53 Beitrittsdatum: 21.01.16 Neueste Beiträge
Hi,

I try to add standard portlets to my theme, for example to have a navigation menu or a site map.
For the navigation theme, I have developed the template code to generate a navigation menu for all of the sub-pages and this works,
but I thought this could be done in a more simple way by just using the standard functionality of Liferay.

I have read https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/embedding-portlets-in-themes-and-layout-templates

What I tried to include a navigation element:
<div class="navbar">
<@liferay_portlet["runtime"]
defaultPreferences=default_preferences
portletName="com_liferay_site_navigation_menu_web_internal_portlet_SiteNavigationMenuPortlet"
/>
</div>

However, although no errors are raised, there is no menu.

So how
- can I include a navigation bar in my theme?
- configure it, similar to the kind of configuration I can do if I add a Navigation menu to a page?

Thanks,

-- JG
thumbnail
Jack Bakker, geändert vor 7 Jahren.

RE: Add navigation menu and sitemap to theme

Liferay Master Beiträge: 978 Beitrittsdatum: 03.01.10 Neueste Beiträge
Have you looked at classic and other themes for examples of navigation elements in theme ?

search "liferay github theme" ; I like the westeros theme as a learning example
thumbnail
Travis Cory, geändert vor 7 Jahren.

RE: Add navigation menu and sitemap to theme

Junior Member Beiträge: 73 Beitrittsdatum: 04.06.13 Neueste Beiträge
Hey JG,

Try using
&lt;@liferay.navigation_menu default_preferences="${freeMarkerPortletPreferences}" /&gt;
. Your method is correct for portlets that do not have a PortletProvider View Action. But for the navigation menu you can use this macro that Liferay has created. You can find how that macro is defined in FTL_liferay.ftl.
J G, geändert vor 7 Jahren.

RE: Add navigation menu and sitemap to theme

Junior Member Beiträge: 53 Beitrittsdatum: 21.01.16 Neueste Beiträge
Thanks.

Is there also a way that I can influence which part of the menu is shown? I can do this if I manually use the portlet, but I do not see how to do this from freemarker
thumbnail
Travis Cory, geändert vor 7 Jahren.

RE: Add navigation menu and sitemap to theme

Junior Member Beiträge: 73 Beitrittsdatum: 04.06.13 Neueste Beiträge
Hey JG

You can set the
${freeMarkerPortletPreferences}
to use the correct preferences you need for your portlet. You can see an example of how you can set the portlet preferences here.