diff --git a/docs/release-notes/version-2.9.md b/docs/release-notes/version-2.9.md
index 55c66cb6a..fd7a99ff0 100644
--- a/docs/release-notes/version-2.9.md
+++ b/docs/release-notes/version-2.9.md
@@ -5,6 +5,7 @@
### Enhancements
* [#1755](https://github.com/netbox-community/netbox/issues/1755) - Toggle order in which rack elevations are displayed
+* [#5134](https://github.com/netbox-community/netbox/issues/5134) - Display full hierarchy in breadcrumbs for sites/racks
### Bug Fixes
diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html
index e97893c30..34d28179b 100644
--- a/netbox/templates/dcim/device.html
+++ b/netbox/templates/dcim/device.html
@@ -11,11 +11,8 @@
- - {{ device.site }}
- {% if device.rack %}
- - Racks
- - {{ device.rack }}
- {% endif %}
+ - Devices
+ - {{ device.site }}
{% if device.parent_bay %}
- {{ device.parent_bay.device }}
- {{ device.parent_bay }}
@@ -101,7 +98,7 @@
-
- Inventory {{ device.inventoryitems.unrestricted.count }}
+ Inventory {{ device.inventoryitems.count }}
{% if perms.dcim.napalm_read_device %}
@@ -151,8 +148,10 @@
{% if device.rack %}
{% if device.rack.group %}
- {{ device.rack.group }}
-
+ {% for group in device.rack.group.get_ancestors %}
+ {{ group }}
+ {% endfor %}
+ {{ device.rack.group }}
{% endif %}
{{ device.rack }}
{% else %}
diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html
index 5ead0ac4f..4cf3b9018 100644
--- a/netbox/templates/dcim/rack.html
+++ b/netbox/templates/dcim/rack.html
@@ -11,6 +11,12 @@
- Racks
- {{ rack.site }}
+ {% if rack.group %}
+ {% for group in rack.group.get_ancestors %}
+ - {{ group }}
+ {% endfor %}
+ - {{ rack.group }}
+ {% endif %}
- {{ rack }}
@@ -87,7 +93,10 @@
| Group |
{% if rack.group %}
- {{ rack.group }}
+ {% for group in rack.group.get_ancestors %}
+ {{ group }}
+ {% endfor %}
+ {{ rack.group }}
{% else %}
None
{% endif %}
diff --git a/netbox/templates/dcim/site.html b/netbox/templates/dcim/site.html
index d6c21bf92..f5823f721 100644
--- a/netbox/templates/dcim/site.html
+++ b/netbox/templates/dcim/site.html
@@ -12,7 +12,7 @@
- Sites
{% if site.region %}
- {% for region in site.region.get_ancestors.unrestricted %}
+ {% for region in site.region.get_ancestors %}
- {{ region }}
{% endfor %}
- {{ site.region }}
@@ -86,7 +86,7 @@
Region |
{% if site.region %}
- {% for region in site.region.get_ancestors.unrestricted %}
+ {% for region in site.region.get_ancestors %}
{{ region }}
{% endfor %}
| |