Hairdressing Express

I want to show Breadcrumbs for my express pages. I couldn't find many and it seems like there are only a few people out there looking to build breadcrumbs on their sites, or there must be a completely different way to solve the problem. I found 2-3 intermediate products that are not actively supported and do not seem to support dynamic routes or are not well documented.

So, I assume I have the following routes and patron names:

  • / => "Home"
  • / projects => "Projects"
  • / projects /: id /: slug => "Projectname from DB"
  • / projects / manage => "Management"

I was expecting a popular middleware that can store breadcrumbs dynamically, and as soon as I call the "subpage" it will return all parent dirges as well. Something like that:

router.get('/:id/:slug', function(req, res, next) {
    var projectName = 'John Doe Project';
    req.breadcrumbs().add({name: projectName, url: '/url/to/project/'});
    res.render('projects/index', { title: 'Express', breadcrumbs: req.breadcrumbs()});
});

      

What is the best practice for providing bread crumbs?

+3


source to share





All Articles