1

How do I parse the breadcrumbs code:

{% if entry.level > 1 %}
    <ul class="crumbs">
        {% for crumb in entry.getAncestors() %}
            <li>{{ crumb.getLink() }}</li>
        {% endfor %}
    </ul>
{% endif %}

into lowercase?

Home > blog > entry title 

or

  home > blog > entry title 

1 Answer 1

5

You can do this with CSS, or with Twig.

CSS:

ul.crumbs li {
  text-transform: lowercase;
}

…or, if you need to start after a particular index…

ul.crumbs li:nth-child(n + 2) { /* Start with the 2nd `li` */
  text-transform: lowercase;
}

Twig:

{% if entry.level > 1 %}
  <ul class="crumbs">
    {% for crumb in entry.getAncestors() %}
      {# Build the link yourself, passing just the title through the `lower` filter: #}
      <li><a href="{{ crumb.url }}">{{ crumb.title | lower }}</a></li>
    {% endfor %}
  </ul>
{% endif %}
1
  • Brilliant August, I was looking for the Twig function!
    – Nutmeg
    Nov 5, 2016 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.