V-Squared / V-Squared.github.io

Initiative for Modular and Upgradable Mini and All-In-One PC. Standards — Know How — Blueprints — Trailblazer Products
http://v-squared.github.io/
Other
2 stars 1 forks source link

Multi Level Breadcrumb from book-bar.yml file #57

Closed LukasChen closed 8 years ago

LukasChen commented 8 years ago

Each Article has a YAML front matter with the breadcrumb attribute. It looks like this:

breadcrumb: system

My Liquid template is looping through all articles and generates the bread crumb.

site.pages contains the URL of each article. To access it:


{% for pages in site.pages %}

{{pages.url}}

{% endfor %}

This works fine, but has the following problems:

  1. reordering the menu items requires to edit every front matter of every article and modify the order attribute
  2. You have no place to see the structure of the book-bar.

    The new way

To reduce maintenance workload we have removed the breadcrumb and order attribute in each articles front matter. The new idea is to read the menu attribute from the book-bar.yml file in order to generate the bread crumb.

Benefits

Nested for loops did not work

References

VillageHubertChen commented 8 years ago

Works great! Thanks for being tough and keep working at it until success, so that creating new articles and maintaining them is much easier.