This repository contains code for visualization of breadcrumbs as seen in the ecommerce websites.
Breadcrumb Navigation is a form of site navigation that shows visitors where they are on a site's hierarchy of pages without having to examine a URL structure
Put all the breadcrumb navigation in a text file. Every breadcrumb navigation should be in a new line.
-
Install
anytree
package from pip. Run the commandpip install anytree
-
Run the python program with the following command
python tree_generator.py --inputFilePath breadcrumbs.txt --sep "/" --nodetoexport "Home"
Argument Explanation:
- --inputFilePath - Input file containing new line delimited breadcrumb navigations
- --sep - Separator between the nodes of a breadcrumb navigation
- --nodetoexport - which node and it's corresponding children to export to json format
-
After you run the python file, 2 json files are generated.
- data.json - Json representation of the tree
- error_records.json - breadcrumb navigations that encountered Error during it's adding/conversion to the tree
-
Run a python server from the current working directory where
index.html
anddata.json
is found. Run the command -python -m http.server
-
Open
http://localhost:8000/
to view the visualization
- Search Node - Searches a given node in whole tree
- Highlight Navigation Path to the node from the root
The visualization for the sample data in the repository can be found at - https://better-boy.github.io/BreadCrumb-Navigation-Visualizer/