Forum
Perch Runway/Blog search result URL isn't working
I've set up multiple blogs in my Perch Runway install, so my Blog post page path is:
/{blogSlug}/{postSlug}
The blogs are working fine, page listings link through to the individual posts fine.
I've now set up a Search results page with the following:
<perch:before>
<div class="row">
<div class="container">
<div class="eight columns">
<h1>Search results for “<perch:search id="search_key">”</h1>
<perch:if exists="paging">
<p><perch:search id="total"> results</p>
</perch:if>
<ul class="plain">
</perch:before>
<li class="<perch:search id="perch_item_odd">">
<h3><a href="<perch:search id="result_url">"><perch:search id="result_title"></a></h3>
<perch:if exists="result_excerpt"><p class="excerpt">…<perch:search id="result_excerpt" encode="false">…</p></perch:if>
<p><a href="<perch:search id="result_url">">
<perch:if exists="result_pageNavText">
<perch:search id="result_pageNavText">
<perch:else />
<perch:search id="result_url">
</perch:if>
</a></p>
</li>
<perch:after>
</ul>
<perch:if exists="paging">
<div class="paging">
Page <perch:search id="current_page"> of <perch:search id="number_of_pages">
<perch:if exists="not_first_page">
<a href="<perch:search id="prev_url" encode="false">">Previous</a>
</perch:if>
<perch:if exists="not_last_page">
<a href="<perch:search id="next_url" encode="false">">Next</a>
</perch:if>
</div>
</perch:if>
</div>
</div>
</div></perch:after>
<perch:noresults>
<perch:if exists="search_key">
<h1>Search results for “<perch:search id="search_key">”</h1>
<perch:else />
<h1>Search</h1>
</perch:if>
<perch:if exists="search_key">
<p>Sorry, there are no results for “<perch:search id="search_key">”.</p>
</perch:if>
</perch:noresults>
The search form, which works fine, is:
<perch:form id="search" method="get" action="/search_results">
<div>
<perch:label for="q">Search</perch:label>
<perch:input type="search" id="q">
<perch:input type="submit" value="Go">
</div>
</perch:form>
However, when the search results are displayed, the URL for the blog post is just the slug, minus the blog path and date. They display in the resulting code as (for example):
<a href="//the-gina-monologues-on-building-my-own-maternity-program">
I'm sure I'm missing something obvious, but I've combed through the search documentation and the forum and haven't found an answer. Help?
What do you get if you enable debug?
I get
It sounds like the blog slug isn't making it through to the search results template. Do you see it at all with
<perch:showall>
?No, the blog slug isn't making it through, though I haven't seen anything in the documentation about how the blog slug is used in conjunction with
<perch:search id="result_url">
. How is the link in the search results created using "result_url", and where are the two slashes coming from in the URL that us being created?With perch:showall I see:
Any idea why the blog slug wouldn't be making it through to the search result_url?