zHaytam / SmartBreadcrumbs

A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.
https://blog.zhaytam.com/2018/06/24/asp-net-core-using-smartbreadcrumbs/
MIT License
161 stars 77 forks source link

Breadcrumb blank when page is in a subfolder #57

Closed chrisjmccrum closed 4 years ago

chrisjmccrum commented 4 years ago

Our razor pages web application is starting to grow so we added subfolders to the Pages directory. So far everything seems to be rendering fine but we're having issues with the last breadcrumb showing blank.

Pages -> Clients ----> Index.html Index.html

zHaytam commented 4 years ago

Hello, I would need a bit more info to try & figure out what's happening, especially how the breadcrumbs are created/configured.

chrisjmccrum commented 4 years ago

Sure thing - The root index is in the main Pages folder which is where the Default BreadCrumb is defined. Any new pages made in the main Pages folder pick up the BreadCrumb service accordingly. If I make a subfolder in Pages like Clients, the pages in the folder render but the BreadCrumb section only shows the Default BreadCrumb.

The only options I set for the BreadCrumb service is this:

            services.AddBreadcrumbs(GetType().Assembly, options =>
            {
                options.TagClasses = "";
                options.OlClasses = "breadcrumb";
                options.LiClasses = "breadcrumb-item";
                options.ActiveLiClasses = "breadcrumb-item active";
            });

The Client BreadCrumb is set the default way at the moment

    [Breadcrumb]
    public class ClientsIndex : PageModel
chrisjmccrum commented 4 years ago

Is there anything else needed on my end to describe the problem? I would love to use this nifty tool in my project

zHaytam commented 4 years ago

If you inspect the breadcrumbs part in your website, how many <li> elements do you find?

chrisjmccrum commented 4 years ago

Just one, the Default BreadCrumb

zHaytam commented 4 years ago

Would it be possible for you to create a small repo that reproduces the issue please?

zHaytam commented 4 years ago

I'm closing this since it's been a while, feel free to re-open if you still have the issue.