URL Tag Outputs Current Search Result URL
When using page_url tag inside exp:low_search:results tag, the tag is being replaced by the current search results page URL instead of the entry URL.
I have search result URLs entered for my channels. I am also using Structure if that has any bearing on the troubleshooting. I am also using encrypted queries.
{exp:low_search:results query="{segment_2}" status="not closed" disable="member_data|category_fields" limit="10"}
{if count == 1}
<p>
{if low_search_keywords}Searched for <strong>{low_search_keywords}</strong>.{/if}
Total results: <strong>{absolute_results}</strong>.
</p>
{/if}
<div class="entry">
<h2><a href="{page_url}">{title}</a></h2>
<p class="url">
{if page_uri}
<a href="{page_uri}" class="result-link">{page_uri}</a>
{/if}
</p>
{low_search_excerpt}
</div>
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{if low_search_no_results}
<p>
We did not find any results matching your search terms.
Check your spelling, or try a different search.
</p>
{/if}
{/exp:low_search:results}
Replies
Low 31 Jul 2014 19:55
Can you give me an example of the unparsed variable, what you'd expect as output and what you're actually getting as output?
Matt 31 Jul 2014 20:06
Live search page on our dev server.
http://pccua.youngerhosting.com/searc...
I expect the URL for that single result to be
http://pccua.youngerhosting.com/catal...
Low 31 Jul 2014 20:11
The bug you were referring to earlier only applied when not encoding queries. When you are using encoded queries, no URLs are rewritten at all.
When the link for a {page_url} refers to the same page as the search query, it might actually mean that the {page_url} is replaced with an empty string.
So, when you check "view source" for the search results page, can you actually see the that URL in the href="" attribute, or is it empty?
Matt 31 Jul 2014 20:13
href is empty.
Low 31 Jul 2014 20:14
Next step: if you add a channel:entries tag to that page and try to output the {page_url} with just native tags, what do you get?
Matt 31 Jul 2014 20:18
No output even with channel entries tag. I will track down what is causing that.
Low 31 Jul 2014 20:19
OK. Let me know if you find anything.