From 06f29eaf903470edcd82c7d87850516705c177ff Mon Sep 17 00:00:00 2001 From: Joshua Nicholson <94021017+jnicholCU@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:06:33 -0700 Subject: [PATCH] Breadcrumbs updates Updates to breadcrumbs to not display breadcrumb div when there are no items in the div --- .../block/block--boulder-base-breadcrumbs.html.twig | 13 +++++++++++++ templates/layout/page.html.twig | 2 +- templates/regions/region--breadcrumb.html.twig | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 templates/block/block--boulder-base-breadcrumbs.html.twig diff --git a/templates/block/block--boulder-base-breadcrumbs.html.twig b/templates/block/block--boulder-base-breadcrumbs.html.twig new file mode 100644 index 00000000..4cad289d --- /dev/null +++ b/templates/block/block--boulder-base-breadcrumbs.html.twig @@ -0,0 +1,13 @@ +{# +/** + * Theme layout to display a UCB Breadcrumb Menu Navigation page. + * The purpose of this template is to make sure that there are more links than the home link in the nav item. + * + */ +#} + +{% if (content['#links']|length > 1) %} +
+ {{ content}} +
+{% endif %} diff --git a/templates/layout/page.html.twig b/templates/layout/page.html.twig index db6c3ed6..2e9ccc56 100644 --- a/templates/layout/page.html.twig +++ b/templates/layout/page.html.twig @@ -152,7 +152,7 @@ {# MAIN PAGE CONTENT #}
- {% if show_breadcrumb %} + {% if (show_breadcrumb) and (page.breadcrumb|render|striptags|trim) %}
{{ page.breadcrumb }}
diff --git a/templates/regions/region--breadcrumb.html.twig b/templates/regions/region--breadcrumb.html.twig index 933df6b0..cfca84fa 100644 --- a/templates/regions/region--breadcrumb.html.twig +++ b/templates/regions/region--breadcrumb.html.twig @@ -20,7 +20,8 @@ ] %} -{% if show_breadcrumb and content %} + +{% if (show_breadcrumb) and (content|render|striptags|trim is not empty) %}
{{ content }}