Giter VIP home page Giter VIP logo

smartbreadcrumbs's Introduction

SmartBreadcrumbs 2.0.0

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
Build Build Status Azure DevOps tests
NuGet NuGet Nuget
License GitHub

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 the Breadcrumb and DefaultBreadcrumb attributes), go ahead and add SmartBreadcrumbs in your services:

services.AddBreadcrumbs(GetType().Assembly);

Use

SmartBreadcrumbs comes with a breadcrumb 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 the BreadcrumbManager and create your own TagHelper for example.

Credits & License

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

smartbreadcrumbs's People

Contributors

zhaytam avatar connerorth avatar askalione avatar maxpiva avatar oleksandrnechaiev avatar kharabet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.