Built out a multilingual site built on perch runway and uses a branch method to organise content.
Having some trouble with searching the site content from the blog application. For some reason I can't get any data from the blog app even if I specify the blog independently through the source. I am pretty sure this is something I have overlooked as at one point at least I could retrieve the blog title within the results, however no I get nothing even when targeting the blog by app alone.
The blog itself is broken down into listing for each lang variable (i.e 'en' and 'de')
Thanks in advance
PHP
- <?php
- $query = perch_get('q');
- perch_content_search($query, array(
- 'data' => [
- 'lang_uppercase' => strtoupper($vars['lang']),
- ],
- 'count' => 6,
- 'from-path' => '/' . $vars['lang'],
- 'excerpt-chars' => 300,
- 'template' => 'site-search-result.html',
- ));
- // target the blog alone to try and get some data
- perch_content_search($query, array(
- 'template' => 'blog-search-result.html',
- 'apps' => ['PerchBlog'],
- ));
- ?>
Code
- <perch:before>
- <div class="row">
- <div class="col-12 ta-c">
- <div class="h1 h1--sm"><perch:search id="total" /> results for "<span class="h2"><perch:search id="search_key" /></span>"</div>
- </div>
- </div>
- <hr />
- <ul class="search--grid row grid-list">
- </perch:before>
- <li class=" col-lg-6 <perch:search id="perch_item_odd" />">
- <perch:if id="source" match="eq" value="PerchContent_RunwaySearch">
- <perch:if id="result_url" match="eq" value="Projects"/>
- <a href="/<perch:search id="lang" /><perch:trans id="lang.projects.url" /><perch:translate id="result_slug" en="{result_slug_en}" de="{result_slug_de}" explicit="true" html="true"/>/" class="eq-margin">
- </perch:if>
- <perch:if id="result_url" match="eq" value="Downloads"/>
- <a href="/<perch:search id="lang" /><perch:trans id="lang.downloads.url" /><perch:translate id="result_slug" en="{result_slug_en}" de="{result_slug_de}" explicit="true" html="true"/>/" class="eq-margin">
- </perch:if>
- <perch:if id="result_url" match="eq" value="Locations"/>
- <a href="/<perch:search id="lang" /><perch:trans id="lang.locations.url" />#location-<perch:translate id="division_en" en="{division_en}" de="{division_de}" explicit="true" />" class="eq-margin">
- </perch:if>
- <perch:if id="result_url" match="eq" value="Team"/>
- <a href="/<perch:search id="lang" /><perch:trans id="lang.about.url" />#team--<perch:search id="dataID"/>" class="eq-margin">
- </perch:if>
- </perch:if>
- <perch:if id="source" match="eq" value="PerchContent">
- <a href="<perch:search id="result_url" />/" class="eq-margin">
- </perch:if>
- <perch:if id="source" match="eq" value="PerchBlog">
- <a href="/<perch:search id="lang" /><perch:search id="result_url" />" class="eq-margin">
- </perch:if>
- <div class="eq-margin">
- <h3 class="h2 h2--sm text-color--pink"><perch:if id="result_title" value="{lang_uppercase}"><perch:trans id="lang.search.home" /> - </perch:if><perch:search id="result_title" /></h3>
- <perch:if exists="result_excerpt"><p class="excerpt">"<perch:search id="result_excerpt" encode="false" html="true"/>…"</p></perch:if>
- </div>
- <span class="link link--right">
- <span><perch:trans id="lang.search.cta" /></span>
- <svg class="icon--arrow-r icon--svg" viewBox="0 0 30 18">
- <use xlink:href="/assets/svg/svg-defs.svg#icon--arrow-r"></use>
- </svg>
- </span>
- <hr />
- </a>
- </li>
- <perch:after>
- </ul>
- <perch:if exists="paging">
- <div class="row ta-c">
- <div class="col-12 ta-c eq-margin">
- <div class="h3">
- <perch:trans id="lang.search.paging.page" /> <perch:search id="current_page" /> <perch:trans id="lang.search.paging.of" /> <perch:search id="number_of_pages" />
- </div>
- <perch:if exists="not_first_page">
- <a class="btn btn--skew btn--fill" href="<perch:search id="prev_url" encode="false" />"><span><perch:trans id="lang.search.prev" /></span></a>
- <perch:else>
- <span class="btn btn--skew btn--disabled"><span><perch:trans id="lang.search.prev" /></span></span>
- </perch:if>
- <perch:if exists="not_last_page">
- <a class="btn btn--skew btn--fill" href="<perch:search id="next_url" encode="false" />"><span><perch:trans id="lang.search.next" /></span></a>
- <perch:else>
- <span class="btn btn--skew btn--disabled"><span><perch:trans id="lang.search.next" /></span></span>
- </perch:if>
- </div>
- </div>
- </perch:if>
- </perch:after>
- <!--* no results *-->
- <perch:noresults>
- <div class="col-12 ta-c">
- <perch:if exists="search_key">
- <perch:trans id="lang.search.result.none" /> "<perch:search id="search_key" />"
- <perch:else />
- <perch:trans id="lang.search.result.empty" />
- </perch:if>
- </div>
- </perch:noresults>
- <!--* no results *-->