Problem with current_path
I’m comparing output from zola 11 verses version 12.
Using the following template snippet:
<!-- Taxonomy SEO -->
<!-- critical -->
{% if term -%}
{% set tparent = current_path | split(pat="/") | first | capitalize -%}
{% set tname = term.name | capitalize -%}
{% if tparent=="English" -%}
<title>English {{ tname }} Lessons</title>
{% elif tparent=="Downloads" -%}
<title>English {{ tname }} {{tparent}}</title>
{% else -%}
<title>Adept English {{ tname }} - {{tparent}}</title>
{% endif -%}
{% else -%}
<title>{{ config.title}}</title>
{% endif -%}
We customised the title of each page based on it’s path. We do this for taxonomies
to get the parent of this term.
Zola 11 output…
<!-- Taxonomy SEO -->
<!-- critical -->
<title>Adept English Andrew - Authors</title>
Zola 12 output…
<!-- Taxonomy SEO -->
<!-- critical -->
<title>Adept English Andrew - </title>
It appears the
{{tparent}}
variable is now empty.
We use split path a lot, mostly for breadcrumbs lists throughout the site.
Zola 11 output…
<nav class="breadcrumb" aria-label="breadcrumbs">
<ul>
<li><a class="is-capitalized" href="https://adeptenglish.com">🏠 Home</a></li>
<li><a class="is-capitalized" href="https://adeptenglish.com/authors">authors</a></li>
<li class="is-active"><a class="is-capitalized" href="#">Andrew</a></li>
</ul>
</nav>
Zola 12 output
<nav class="breadcrumb" aria-label="breadcrumbs">
<ul>
<li><a class="is-capitalized" href="https://adeptenglish.com">🏠 Home</a></li>
<li><a class="is-capitalized" href="https://adeptenglish.com/"></a></li>
<li class="is-active"><a class="is-capitalized" href="#">Andrew</a></li>
</ul>
</nav>
Note the missing authors
Thoughts…
I’m pretty sure this is because the split path | first no longer works as current_path
now has an additional /
slash.
If the new current_path is necessary, could you suggest a way of splitting the path and getting the same output as we used to using tera split path?