django-dynamic-breadcrumbs icon indicating copy to clipboard operation
django-dynamic-breadcrumbs copied to clipboard

Is it possible to capitalize each breadcrumb?

Open abe-101 opened this issue 1 year ago • 1 comments

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

abe-101 avatar May 24 '24 19:05 abe-101

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>

abe-101 avatar May 27 '24 03:05 abe-101