jigsaw icon indicating copy to clipboard operation
jigsaw copied to clipboard

[Feature Request] Generated navigation

Open ToddSmithSalter opened this issue 10 years ago • 2 comments

I would love to have the ability to generate navigation from a directory of markdown files.

We have a repo of markdown files I would like to pull in as a submodule, have a rebuild triggered, and navigation generated in the template. Regarding sorting, navigation could be spit out alphabetically, or a standardized filename syntax could be established to number the files with prefix to specify the order.

// This spits out an alphabetized array
my_awesome_file.md
a_silly_file.md
stupid_post.md

// This spits out a numbered array
01_my_awesome_file.md
02_a_silly_file.md
03_stupid_post.md

Paired with #24, this could be really powerful, displacing the default source directly to wherever you wish and spitting out structured nav.

ToddSmithSalter avatar May 05 '16 21:05 ToddSmithSalter

Isn't using directories kind of inflexible? A menu item could live in whatever directory, when perhaps using something like Page Meta / Front Matter, with say:

---
# yada yada yada
nav: main
# yada yada yada
---

And then outputting in a .blade.php file:

<ul>
@foreach(nav('main') as $navItem)
    <li><a href="{{ $navItem->url }}">{{ $navItem->name }}<li>
@endforeach
</ul>

Or something along those lines...

kobykorman avatar Jul 10 '16 02:07 kobykorman

Take a look at collections in v1.0.0, which makes this possible. There's also example code for a generated nav in the demo repo.

damiani avatar Apr 21 '17 20:04 damiani