nanoc / features

Collection of feature requests
2 stars 1 forks source link

Sub-level index support for breadcrumbs + child-parent helpers #7

Open denisdefreyne opened 7 years ago

denisdefreyne commented 7 years ago

#breadcrumbs_trail only treats the index filename special at the root. For example:

/index.md
  /firstlevel.md
    /firstlevel/index.md
    /firstlevel/secondlevel.md
      /firstlevel/secondlevel/index.md

I propose adding a :allow_index option to #breadcrumbs_trail. If false (default), the behaviour stays the same. If true, the behaviour changes so that index.* filenames are considered to be at the equal level. The example above with allow_index: true would then become either

/index.md
  /firstlevel.md
  /firstlevel/index.md
    /firstlevel/secondlevel.md
    /firstlevel/secondlevel/index.md

or

/index.md
  /firstlevel/index.md
   firstlevel.md
    /firstlevel/secondlevel.md
    /firstlevel/secondlevel/index.md

In the case where the parent is ambiguous (such as in the example above), #breadcrumbs_trail should raise an error.

The same also applies to the child-parent helper.

ghiknt commented 7 years ago

:+1: Thanks