Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.

License

NotificationsYou must be signed in to change notification settings

zHaytam/SmartBreadcrumbs

Repository files navigation

A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.

About the 2.0.0 version

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.

Informations

Badges
BuildBuild StatusAzure DevOps tests
NuGetNuGetNuget
LicenseGitHub

Documentation & Example

  • Wiki: A list of all the possible things you can do with SmartBreadcrumbs.
  • RazorPagesAndMvc: An example project containing both MVC and Razor Pages pages. Check it out to see how SmartBreadcrumbs works.

Usage

Install

Install the package using NuGet
Install-Package SmartBreadcrumbs

Initialize

After you have setup your breadcrumbs (using theBreadcrumb andDefaultBreadcrumb attributes), go ahead and add SmartBreadcrumbs in your services:

services.AddBreadcrumbs(GetType().Assembly);

Use

SmartBreadcrumbs comes with abreadcrumb tag that renders the breadcrumbs for you, to use it:

  1. In_ViewImports.cshtml, add@addTagHelper *, SmartBreadcrumbs.
  2. In your_Layout.cshml (or specific pages), use<breadcrumb></breadcrumb>.

Customize

Options

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>";});

More

Check out the documentation if you need more customization!

  • You can manually create and set breadcrumb nodes, useful when you have dynamic breadcrumbs (e.g. E-Commerce website).
  • You can get access to theBreadcrumbManager and create your ownTagHelper for example.

Credits & License

Credits: zHaytam and the contributors.
License: SmartBreadcrumbs is open source, licensed under theMIT License.


[8]ページ先頭

©2009-2025 Movatter.jp