gma / nesta

File Based CMS and Static Site Generator
http://nestacms.com
MIT License
902 stars 121 forks source link

Support for other menus #111

Closed ashmckenzie closed 10 years ago

ashmckenzie commented 12 years ago

Hi Graham,

I had the need to create a categories.txt (in the same style as menu.txt), so made a few minor changes to support this.

Hopefully it's a desirable change.

Ash.

gma commented 12 years ago

Hi Ash. Thanks. Does this allow you to setup menus that can't be produced by including whatever menu hierarchy you like in menu.txt, and then using the menu rendering helpers to render just a small part of the full menu.txt file?

ashmckenzie commented 12 years ago

Hi :) I'm using the menu.txt for page links and wanted to keep links to page / article categories separate. I tried to work menu.txt to my needs but it didn't seem like a logical fit. The site I'm working on is http://new.ashmckenzie.org/ (still a WIP)

Happy for advice on how I might be able to achieve this using the existing heleprs ?

gma commented 12 years ago

Have you tried having two different sections in your menu.txt file, and calling Nesta::Menu.for_path('/a-section') in your view? You should be able to maintain two completely separate menu hierarchies that way...

Site looks nice, btw.

ashmckenzie commented 12 years ago

Sorry for the (very) late response. Thanks for the suggestion, I tried it but it didn't work for me as in my case the contents of my categories.txt are located at the root level:

euro-trip-2010
mongo
ruby
devops
display_menu(Nesta::Menu.for_path('/', 'categories.txt'), :levels => 1)

See the menu.txt entries on the left and the categories.txt entries on the right - http://ashmckenzie.org/

travisbot commented 12 years ago

This pull request passes (merged c58158a9 into 025188aa).

gma commented 10 years ago

I'm going to have a think about whether or not this can be done sensibly with a single menu file. I'm not massively comfortable with the proliferation of lots of .txt files in content (perhaps they should be .menu files). Thinking about it…

In the meantime, I'm going to close this issue to things tidy and help me get the next release out of the door.