Breadcrumbs, also known as site navigator, is useful Joomla module. And, as every module, it can be linked to all or only certain menu items. It is also possible to unlink this module from all or specific items. Many Joomla website owners wish to hide navigator on the home page, since it contains only one item "Home" with no link and does not incurs thus any functional load. Perhaps the site structure also provides other pages on which, for whatever reasons, it makes sense to hide navigator. The most typical example is a custom 404 error page, which, as I emphasize in the corresponding article dedicated to the rules of its creation and configuration, should fit into a site template, but at the same time to be by itself. Navigator on page 404 is not only unnecessary, but also ideologically harmful. We will consider this particular page as a special case, which describes the general principle of unlinking breadcrumbs from certain article.

The standard way to the module linking is not suitable here, since, as described in the above article, the menu item for the error page is not being created. In fact, such item can nevertheless be created (without binding it to a page, but only to link modules - such as breadcrumbs in our case). Then you can hide the navigator for this page by selecting On all pages except those selected in Module Assignment dropdown box on the page of editing module parameters in the site's admin interface. Such a method works well in this case; when adding new items to the different menues breadcrumbs will automatically get attached to them, so it is not required to do it manually every time (unlike the alternative Only on the pages selected; there it is necessary to manually add each created menu item to the module). However, its disadvantage is the need to create menu items for articles, even when there is no other need of this binding. All these menues are added as additional tabs in the Menu Selection sections of all modules, and interface becomes overloaded. This issue particularly reveals itself in case of multi-language, where you have to separately create a menu for each language, and, accordingly, the number of tabs in the module editing interface increases in proportion to the number of languages.

Given the above reasons, I prefer an alternative solution. Though it will require some skills of reading and editing PHP-code. Yet, if you are carefully following these instruction, the minimal knowledge is sufficient.

We will start, as always, with identification of the file and the place in its code, which will be edited. Breadcrumbs module has a separate position, which is set in the index.php file of the active template. It is located in the folder templates\[my_template]. Replace [my_template] with the real name of your template's folder. Open the file for editing and find the occurrence of navigator module in its code. There are different options. For example, in templates Beez2 and Beez5 that are supplied with Joomla, the desired piece of code looks like this:

<div id="breadcrumbs">
 
  <jdoc:include type="modules" name="position-2" />
 
</div>

In my custom template, whose structure was built in Artisteer, navigator is brought out using a special function artxPost, and its call in index.php looks like this:

if ($view->containsModules('breadcrumb')
  echo artxPost($view->position('breadcrumb'));

In other templates the code of breadcrumbs may be different, but the general principle is to find the right place in the code by searching either the word "breadcrumb", or, if in your template the module is located in a position with less intuitively appropriate name - so search for this name. It's easy to ascertain module's position by opening its editing page in the administration service. Preview in template manager may also clarify module position (if to previously enable the Preview Module Positions option in its settings).

Now we assign a code to disable the output of the module according to our conditions. If you simply want to remove it from the home page, the criterion is:

JRequest::getVar('view') != 'frontpage'

Applying it to the first example (Beez2 or Beez5), substitute the following portion of code for the above one:

<div id="breadcrumbs">
 
<?php if (JRequest::getVar('view') != 'frontpage') { ?>
  <jdoc:include type="modules" name="position-2" />
<?php } ?>
 
</div>

In the second example (template built in Artisteer) the modified code will be the following:

if ($view->containsModules('breadcrumb') &&
    JRequest::getVar('view') != 'frontpage')
  echo artxPost($view->position('breadcrumb'));

We now return to the situation where you want to remove the navigator module from specific article pages. Consider the case of a multilingual site (namely - bilingual, like mine is at the time of this writing), and eliminate breadcrumbs on both English and Russian pages 404. At first find out IDs of corresponding articles. This is easily done by finding them in the list of articles in the admin service. In my case, the identifier of Russian page is 80, and the ID of the English one is 448. The following code fragments intended, as in the previous case, to replace the existing ones. Just replace my values of IDs with yours​​ (read more about that construction in an article describing the methodology of selective output of social media buttons).

The first example:

<div id="breadcrumbs">
 
<?php
  $article_id = explode(':', JRequest::getVar('id'));
  if (!(JRequest::getVar('view') == 'article' &&
        ($article_id[0] == '80' || $article_id[0] == '448'))) {
?>
  <jdoc:include type="modules" name="position-2" />
<?php } ?>
 
</div>

The second example:

if ($view->containsModules('breadcrumb') &&
    !(JRequest::getVar('view') == 'article' &&
      ($article_id[0] == '80' || $article_id[0] == '448'))) {
  echo artxPost($view->position('breadcrumb'));

Using this technique you can hide the breadcrumbs on any other pages by simply adding their IDs to the clause. You can also invert the logics and remove the navigator from all articles other than those listed (details - ibid). And finally - it allows you to manipulate with other modules which allocated in separate positions in your web site's main template.

Users must be registered and logged in to post comments.

By working with this site, you agree to our use of cookies necessary to keep the settings you select, as well as for the normal operation of Google services.