Create breadcrumb with wix code

Hey
Let’s say you want a level of three in your breadcrumbs so se simplest way would be to create teh below array object.

let breadCrumbs = {
  level1Name: "Personal Banking",
  level1Url: "/personal-banking",
  level2Name: "Loans",
  level2Url: "/personal-banking-loans",
  level3Name: "Cash Loans",
  level3Url: "/personal-banking-loans-cash-loans"
}

Then in your code use the import {session} as you can read more about in the API Docs.

Then in your pages set the values when you hit the first page set breadCrumbs.level1Name = “Whatever title” and so on…

Use session.setItem(“breadcrumbs”, JSON.stringify(breadCrumbs)) to store that array in a session based JSON object… in your other page read in the array let breadCrumbs = JSON.parse(session.getItem(“breadcrumbs”)) so you will get the values in…

Then use a text elements html feature to set up your breadcrumbs like

$w(“#textElementID”).html = “” + breadCrumbs.level1Name + “&nbsp>&nbsp” + here comes level2 and so on…

Then you must use some kind of IF level1 exists do it, IF level2 and so on…

But I hope I can get you in the right direction.