django-dynamic-breadcrumbs
django-dynamic-breadcrumbs copied to clipboard
Is it possible to capitalize each breadcrumb?
Is there a way to automatically capitalize the first letter of each breadcrumb title within the template? I'm looking to ensure that each breadcrumb appears with its first letter in uppercase
Another approach is to use the builtin title filter
{% load i18n %}
<nav aria-label="breadcrumb">
<ol class="breadcrumb alert alert-success" itemprop="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
{% for item in breadcrumbs %}
{% if forloop.last %}
<li class="breadcrumb-item active" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" aria-current="page">
<span itemprop="name">{{ item.name|title }}</span>
<meta itemprop="position" content='{{item.position}}' />
</li>
{% else %}
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
{% if item.resolved %}
<a itemprop="item" href="{{item.url}}" >
<span itemprop="name">{{item.name|title}}</span>
</a>
<meta itemprop="position" content="{{item.position}}" />
{%else%}
<span itemprop="name">{{item.name|title}}</span>
<meta itemprop="position" content="{{item.position}}" />
{%endif%}
</li>
{% endif %}
{% endfor %}
</ol>
</nav>