How to Create an Automatic Breadcrumb Trail from the URL in Webflow
Learn how to automatically generate breadcrumbs from the URL in Webflow with JSON-LD structured data.
In this tutorial, Sandro — co-founder of the Gemeos Webflow agency — shows you how to automatically generate breadcrumbs from the URL in Webflow, with JSON-LD structured data for SEO.
Example
Breadcrumb generated from the current URL
| URL | Generated breadcrumb | JSON-LD |
|---|---|---|
| www.gemeosagency.com/en/academy/mon-article | Home / Academy / My Article | Yes, automatic |
| www.gemeosagency.com/fr/blog/post | Home / Blog / Post | Yes, automatic |
| www.gemeosagency.com/fr/services | Home / Services | Yes, automatic |
1. Create the container in Webflow
Create a Div with the ID breadcrumb where you want the breadcrumb to appear. Set it to display: none by default: the script will make it visible and inject the content.
2. Customize the labels
The labels object turns URL slugs into readable labels. Add your own mappings: 'nos-offres': 'Our offers'.
3. Add the script in Footer code
(function() {
var container = document.getElementById('breadcrumb');
if (!container) return;
var labels = {
'academie': 'Academy',
'blog': 'Blog',
'services': 'Services',
'realisations': 'Case Studies',
'contact': 'Contact',
};
var parts = window.location.pathname.split('/').filter(Boolean);
var html = 'Home';
var path = '';
parts.forEach(function(part, i) {
path += '/' + part;
var label = labels[part] || part.replace(/-/g, ' ').replace(/\b\w/g, function(c) { return c.toUpperCase(); });
html += '/';
if (i === parts.length - 1) {
html += '' + label + '';
} else {
html += '' + label + '';
}
});
container.innerHTML = html;
container.style.display = 'flex';
container.style.alignItems = 'center';
container.style.fontSize = '13px';
container.style.flexWrap = 'wrap';
container.style.gap = '0';
})();4. Add the JSON-LD structured data
This second script automatically generates the BreadcrumbList schema for Google. Add it right after the first one in the Footer code.
// JSON-LD for breadcrumbs (SEO)
(function() {
var parts = window.location.pathname.split('/').filter(Boolean);
var items = [{ '@type': 'ListItem', position: 1, name: 'Home', item: window.location.origin }];
var path = window.location.origin;
parts.forEach(function(part, i) {
path += '/' + part;
items.push({ '@type': 'ListItem', position: i + 2,
name: part.replace(/-/g, ' '), item: path });
});
var script = document.createElement('script');
script.type = 'application/ld+json';
script.textContent = JSON.stringify({ '@context': 'https://schema.org',
'@type': 'BreadcrumbList', itemListElement: items });
document.head.appendChild(script);
})();Conclusion
An automatic breadcrumb saves you from managing it manually page by page. Best use cases:
- Sites with lots of nested pages (blog, academy, docs)
- E-commerce sites with categories and subcategories
- Multilingual sites with a consistent URL structure
Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.






.avif)





