1{if isset($smarty.capture.path)}{assign var='path' value=$smarty.capture.path}{/if}
2
3{if !empty($path)}
4  {* Extract bradcrumb links from anchors *}
5  {$matchCount = preg_match_all('/<a.+?href="(.+?)"[^>]*>([^<]*)<\/a>/', $path, $matches)}
6  {$breadcrumbs = []}
7  {for $i=0; $i<$matchCount; $i++}
8    {$breadcrumbs[] = ['url' => $matches[1][$i], 'title' => $matches[2][$i]]}
9  {/for}
10
11  {* Extract the last breadcrumb which is not link, it's plain text or text inside span *}
12  {$match = preg_match('/>([^<]+)(?:<\/\w+>\s*)?$/', $path, $matches)}
13  {if !empty($matches[1])}
14    {$breadcrumbs[] = ['url' => '', 'title' => $matches[1]]}
15  {elseif !$match && !$matchCount}
16    {$breadcrumbs[] = ['url' => '', 'title' => $path]}
17  {/if}
18{/if}
19
20<ol class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
21  <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
22    <a href="{if isset($force_ssl) && $force_ssl}{$base_dir_ssl}{else}{$base_dir}{/if}" title="{l s='Home Page'}" itemprop="item">
23      <span itemprop="name">{l s='Home'}</span>
24    </a>
25    <meta itemprop="position" content="1">
26  </li>
27  {if !empty($breadcrumbs)}
28    {foreach from=$breadcrumbs item=breadcrumb name=crumbs}
29      <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
30        {if !empty($breadcrumb.url)}
31          <a href="{$breadcrumb.url}" itemprop="item">
32            <span itemprop="name">{$breadcrumb.title}</span>
33          </a>
34        {else}
35          <a href="#" title="{$breadcrumb.title}" itemprop="item">
36            <span itemprop="name">{$breadcrumb.title}</span>
37          </a>
38        {/if}
39        <meta itemprop="position" content="{($smarty.foreach.crumbs.iteration|intval + 1)}">
40      </li>
41    {/foreach}
42  {/if}
43</ol>
44
45{if isset($smarty.get.search_query) && isset($smarty.get.results) && $smarty.get.results > 1 && isset($smarty.server.HTTP_REFERER)}
46  <nav>
47    <ul class="pager">
48      <li class="previous">
49        {capture}{if isset($smarty.get.HTTP_REFERER) && $smarty.get.HTTP_REFERER}{$smarty.get.HTTP_REFERER}{elseif isset($smarty.server.HTTP_REFERER) && $smarty.server.HTTP_REFERER}{$smarty.server.HTTP_REFERER}{/if}{/capture}
50        <a href="{$smarty.capture.default|escape:'html':'UTF-8'|secureReferrer|regex_replace:'/[\?|&]content_only=1/':''}" name="back">
51          <span>
52            {if $isRtl}&rarr;{else}&larr;{/if} {l s='Back to Search results for "%s" (%d other results)' sprintf=[$smarty.get.search_query,$smarty.get.results]}
53          </span>
54        </a>
55      </li>
56    </ul>
57  </nav>
58{/if}
59