blog-banner

Breadcrumbs with Hansel module-2 : Steps to create Breadcrumbs for all scenarios

  • BREADCRUMBS
  • Drupal Planet
  • HANSEL

The switches and hopes in the Hansel module are called Hansel Flow. To make a Hansel module work, we should create

  1. A new rule called "Start"(It is a standard and fixed name to make the flow happen, so do not change this under any situation),
  2. Under parent as 'root', add a single link as 'action with breadcrumbs' and switch as 'action'.
  3. I Insist to go with the switch as the action because it can cover a huge and future intention to developing sites.

The next button leads to another form where we can specify the Name and Link.

  1. In most cases, the name would be 'Home' or 'Site name'. The main purpose of the start is to indicate the root path in the site, where in most cases it is home.
  2. The Link can be given as <front> to redirect to the home page. It is a stash thumb rule to switch with path alias. Once completed finishing the formalities.

So, now we have a Home (Hansel flow name as a start). As a wrap-up thing, click in the switch on path alias and select 'contains' instead of 'starting with. Before getting into the next part I expect the reader to have a good perceptual ability. The Hansel flow is not all about what I have done, it is about what you need, With this caveat, I get into the real stuff of the Hansel flow.

Rule 1: All the other rules should atleast have start as its parent, only then we can make the flow happen else case ignores the rule and stops the generation of the breadcrumbs.

Rule 2: Please try to use aliased path in the URL.

Rule 3 : Use <front> to redirect to home page.

Rule 4 : Use <none> to link to nothing in 'Add sinle link'.

Create another rule's name based on the URL (Since we are going to switch based on the path alias) and use 'start' as their parent. The actions with the Breadcrumbs provide a clear picture of how to use this Hansel flow. We need to remember one thing at this point, by default we get a single hierarchy of the present page title as in the Breadcrumbs. So we need not create the flow for the 2-step navigation. The 'start' will take of it. for example, "Home->Blog" will be created by the Hansel flow even if we forget to create a rule for Blog.

Example Flow: www.sitename.com/info/about/city/author

  1. Create a rule called 'info' with the start as a parent. Add a single link and use the switch as action (Use goto about). In the next form enter the title as 'info' and the path as 'info' (Do not use / before the paths).
  2. Create another rule called 'about' with info as its parent (use goto city)t. Use the above settings to complete this rule.
  3. Similarly, create another rule called 'city' with about as its parent and complete the settings same as the above steps.

The above case can be extended as per your needs. The prime rule to remember is, Nothing related to breadcrumbs is impossible for Hansel so do not blame the module for not doing what you want, instead claim the blame as I did in the initial stages to learn this.

Get awesome tech content in your inbox