The example above assumes that you have control over the URL used for the link. However, in some cases, the link is created automatically for you and therefore you don't have the option of manually changing the Itemid of the URL. Examples of this include the Latest News and Most Popular modules, both of which give you links to articles automatically. In this situation, you can still control which modules display when you link to an article. Here are three possible approaches.
- The simplest trick is to assign modules to All menu items. That way they show up no matter what. But you have to be OK with having the modules on every page.
- Another possibility is to use a hidden menu item with a Section or Category layout. You can do this on a "hidden" menu and not create a menu module for this "hidden" menu. This gives you a menu item so that you can then assign the desired modules to each layout. If you don't have an article layout for the article being linked to, Joomla will try to find a "similar" menu item and use the modules for that item. For example, if you create a hidden menu item with a section layout and assign the modules that that menu item, then when you link to an article in that section, the modules assigned to the hidden section layout will display. This also works for category layouts. There is a hierarchy for this, as follows:
- Article Layout
- Category Blog Layout
- Category List Layout
- Note that, if you have the Breadcrumbs module enabled, these hidden menu items will show in the breadcrumbs. This means that a user will be able to navigate to the hidden menu item (for example, the section list layout) from the link in the breadcrumbs.
- The sure way to fix this (but also the most work) is to create a separate menu item for each article. This is the most work, but it allows you to completely control the modules displayed for each article.
Posted in: Joomla