Skip to content

Commit 9755984

Browse files
authored
CMD-162: disable 2nd-level CMS breadcrumb (#838)
1 parent 1ddbd27 commit 9755984

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

taccsite_cms/templates/nav_cms_breadcrumbs.html

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
{# @var className #}
22
{% load menu_tags %}
33

4-
<nav class="s-breadcrumbs {{className}}">
4+
{# To adjust style of "disabled" link #}
5+
{# NOTE: Not using `block`, so markup is together for devs in live markup #}
6+
<style>
7+
.s-breadcrumbs a:not([href]) {
8+
opacity: 1;
9+
color: unset;
10+
}
11+
</style>
12+
13+
<nav class="s-breadcrumbs {{className}}" id="cms-breadcrumbs">
514

615
{# To support structured data, item* attributes are used #}
716
{# SEE: https://confluence.tacc.utexas.edu/x/5yMFDg #}
@@ -14,3 +23,15 @@
1423
</ol>
1524

1625
</nav>
26+
27+
{# To disable 2nd-level breadcrumb #}
28+
{# NOTE: Not using `block`, so markup is loaded first #}
29+
{# NOTE: Not using `block` nor `type="module"`, so effect is quicker #}
30+
<script>
31+
{# FAQ: Attempts to do this server-side failed cuz useful props are blank #}
32+
{# https://docs.django-cms.org/en/release-3.11.x/reference/navigation.html#properties-of-navigation-nodes-in-templates #}
33+
document
34+
.getElementById('cms-breadcrumbs')
35+
.querySelector('li:nth-of-type(2) > a')
36+
.removeAttribute('href');
37+
</script>

0 commit comments

Comments
 (0)