How to Truncate Long Breadcrumb Titles in Drupal for Better Accessibility
Joan Català addresses a UI accessibility issue in Drupal where breadcrumb trails become unreadable due to long node titles. When breadcrumbs wrap to multiple lines, they clutter the page and disrupt navigation clarity.
Joan's proposed fix is simple: truncate the node title in the breadcrumb to 28 characters, appending an ellipsis. This is done by modifying breadcrumb.html.twig
to check the string length and slice it accordingly. A final drush cr
clears the cache to apply the change.
This snippet improves usability without affecting content or SEO. It’s a practical tip for multilingual or verbose content sites where long titles are common. Though minor, the adjustment enhances frontend accessibility and overall design polish.
Source Reference
Date of Publication