Hello,
I just want to make sure if my way of displaying breadcrumbs only on the products page is the most optimal way, or if there is perhaps some other simpler way to osiagn this effect.
I have added JavaScript code to display breadcrumbs only on pages with the initial category address
document.addEventListener('DOMContentLoaded', function() {
var breadcrumbContainer = document.querySelector('.page-heading');
if (breadcrumbContainer) {
var path = window.location.pathname;
if (path === '/shop' || path.startsWith('/shop/') || path.startsWith('/category/')) {
breadcrumbContainer.style.display = 'block';
} else {
breadcrumbContainer.style.display = 'none';
}
}
});
It annoys me a little that when loading the page for a fraction of a second you can see breadcrumbs on pages where I removed them.