If your Joomla site uses Weblinks and the Smart Search component, any search results that match weblinks will open the link in the current window, regardless of your weblinks configuration.

You can fix this with a small template override.

Weblinks configuration

You have probably already set the link 'target' to 'Open in a new window' for individual items:

and/or the component default:
Component default

These settings work as expected in the normal weblink menu item types such as 'List Weblinks in a Category' as well as other ways of displaying these items.

Unfortunately, if you search for these items, the link in the search results obstinately refuses to co-operate, using the current window as the link target (meaning that your users are sent away from your site, perhaps never to return).


The solution is to override the output of the finder component (which is Smart Search) for just weblink items. This turns out to be quite easy.

You should make any changes on a test server first before applying them to a production environment. And make a backup etc, etc don't blame me if it all goes horribly wrong.

1. Copy the default results template from the component to your template overrides directory.

From: {yoursite}/components/com_finder/views/search/tmpl/default_result.php

To: {yoursite}/templates/{yourtemplate}/html/com_finder/search/default_result.php

Note that the directory tree is a little different between the two locations.

2. Rename the default template so that it applies only to weblinks.

From: default_result.php

To: default_weblink.php

3. Edit the code to add a target to the link.


<dt class="result-title <?php echo $mime; ?>">
    <a href="/<?php echo JRoute::_($route); ?>"><?php echo $this->result->title; ?></a>


<dt class="result-title <?php echo $mime; ?>">
    <a target="_blank" href="/<?php echo JRoute::_($route); ?>"><?php echo $this->result->title; ?></a>

Note the addition of the target="_blank" clause.

4. Save and of course test the result before applying that same change to your production environment.


Jooma documentation http://docs.joomla.org/Customising_the_Smart_Search_results_page