I'm setting up a search feature on a site and one of the channels that it's searching is downloads. Rather than link all download results to the downloads page using the {auto_path} tag and then expect the user to find the download they want, I'd like to create a link which will actually download the file from the search results page.
The issue is that when trying to do this, subsequent results seem to have incorrect links, as if the search module is getting confused?
Here's my code, any thoughts or alternative ways to achieve this are massively appreciated!
Thanks in advance,
Tom
{exp:search:search_results}
<div class="col span_1_of_1 search_results">
<div class="padding">
<h3 class="no_margin_bottom">
{if channel == 'Downloads'}
{if download_file != ''}
<a href="{download_file}">{title}</a>
{if:elseif download_link != ''}
<a href="{download_link}">{title}</a>
{/if}
{if:else}
<a href="{auto_path}">{title}</a>
{/if}
</h3>
<p class="subtitle extra_margin_bottom">{entry_date format="%j%S %F %Y"}</p>
<span class="label">{channel}</span>
<p>{excerpt}</p>
{if channel == 'Downloads'}
{if download_file != ''}
<a href="{download_file}" download target="_blank" >Download</a>
{if:elseif download_link != ''}
<a href="{download_link}" download target="_blank" >Click to download</a>
{/if}
{if:else}
<a href="{auto_path}">Read more</a>
{/if}
</div>
</div>
{/exp:search:search_results}