A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.
When I created SmartBreadcrumbs, it only worked on MVC websites.
Razor Pages then came out and became "more popular", so I rewrote the whole code base, cleaned the project's structure, wrote unit tests and now, SmartBreadcrumbs works on both MVC and Razor Pages websites, even on the same project.
If you're interested in the README of the old version, it's available here: OLD_README.
Badges | |
---|---|
Build | |
NuGet | |
License |
Install the package using NuGet
Install-Package SmartBreadcrumbs
After you have setup your breadcrumbs (using the Breadcrumb
and DefaultBreadcrumb
attributes), go ahead and add SmartBreadcrumbs in your services:
services.AddBreadcrumbs(GetType().Assembly);
SmartBreadcrumbs comes with a breadcrumb
tag that renders the breadcrumbs for you, to use it:
_ViewImports.cshtml
, add @addTagHelper *, SmartBreadcrumbs
._Layout.cshml
(or specific pages), use <breadcrumb></breadcrumb>
.You can specify options when you initialize SmartBreadcrumbs:
services.AddBreadcrumbs(GetType().Assembly, options =>
{
options.TagName = "nav";
options.TagClasses = "";
options.OlClasses = "breadcrumb";
options.LiClasses = "breadcrumb-item";
options.ActiveLiClasses = "breadcrumb-item active";
options.SeparatorElement = "<li class=\"separator\">/</li>";
});
Check out the documentation if you need more customization!
BreadcrumbManager
and create your own TagHelper
for example.Credits: zHaytam and the contributors.
License: SmartBreadcrumbs is open source, licensed under the MIT License.