There are some functions that I miss while using the menu tag: 1) Would it be possible for the used_nodes option to draw a distinction between files and directories? 2) Would it make sense to use not only H1 for the fragments, but also H2, H3, etc.? 3) Would it be possible to instruct the menu tag to render menu items that are outside of the current branch of the hierarchy? Example tree: +--directoryA | |--fileA1.html | |--fileA2.html | |--directoryB | |--contact.html |--about.html |--index.html Suggestion 1) could be used to just render "contact" and "about", which is the case for a typical meta navigation menu, which otherwise needs be created manually. Possibility 3) could be used to render "fileA1" and "fileA2" while being inside of "about". It is easy to think of examples where this is useful. For what it''s worth... Michael
On 2010-06-22 13:43 +0200 Michael Franzl wrote:> There are some functions that I miss while using the menu tag: > > 1) Would it be possible for the used_nodes option to draw a > distinction between files and directories?This could probably be done, yes. But note that when files in a sub directory are in the menu, the sub directory will also be in the menu! Referring to your example tree, if you want to use the menu tag for rendering a menu consisting of only "contact" and "about", these two pages have to be in the menu. So just restrict the menu to showing only one level and make sure that the directories themselves don''t have the `in_menu` key set. Then only "contact" and "about" will show up in the menu.> 2) Would it make sense to use not only H1 for the fragments, but also > H2, H3, etc.?This is already done. Just make sure that all headers you want to fragment nodes for have an ID set.> 3) Would it be possible to instruct the menu tag to render menu items > that are outside of the current branch of the hierarchy? > > Possibility 3) could be used to render "fileA1" and "fileA2" while > being inside of "about". It is easy to think of examples where this > is useful.This can be already be done. Just set the `min_levels` option of the menu tag to `2` and `show_current_subtree_only` to `false`. Then the second menu level is shown although "about" is on the first menu level. Note, however, that all other second level menu items would also be shown.> Example tree: > > +--directoryA > | |--fileA1.html > | |--fileA2.html > | > |--directoryB > | > |--contact.html > |--about.html > |--index.htmlI already have many notes and todos regarding the restructuration of the menu tag so that it will be more useful and versatile... However, I don''t know when these changes will be implemented. -- Thomas
Thomas Leitner wrote:> Referring to your example tree, if you want to use the menu tag for > rendering a menu consisting of only "contact" and "about", these two > pages have to be in the menu. So just restrict the menu to showing only > one level and make sure that the directories themselves don''t have the > `in_menu` key set. Then only "contact" and "about" will show up in the > menu.This works if there is just one menu. But when there are two menus (e.g. one main menu and one meta navigation menu) the in_menu settings will conflict, because it is different from menu to menu.>> 2) Would it make sense to use not only H1 for the fragments, but also >> H2, H3, etc.? > > This is already done. Just make sure that all headers you want to > fragment nodes for have an ID set.Ah, what I was missing the min_levels option. Thanks.>> 3) Would it be possible to instruct the menu tag to render menu items >> that are outside of the current branch of the hierarchy? >> >> Possibility 3) could be used to render "fileA1" and "fileA2" while >> being inside of "about". It is easy to think of examples where this >> is useful. > > This can be already be done. Just set the `min_levels` option of the > menu tag to `2` and `show_current_subtree_only` to `false`. Then the > second menu level is shown although "about" is on the first menu level. > Note, however, that all other second level menu items would also be > shown.That all other second level menu items would also be shown is a disadvantage I think. Maybe in the future it is possible to specify "directoryA" to the menu tag, and it will descend only from there.> I already have many notes and todos regarding the restructuration of the > menu tag so that it will be more useful and versatile... However, I > don''t know when these changes will be implemented.No problem or hurry, I just thought I make those suggestions because I encountered them in a project. Thanks, Michael
Another suggestion from me ;) Sometimes web developers want to make the format of an html element dependent on the content of the element. For example you have a menu with two entries, and you want each entry have a different color (say "summer" should be red, "winter" should be blue, etc.). This is not possible in an automatically generated menu, without id or class attributes set. Would it be possible to add an id or class attribute also to menu entries (li and span), as it is done in headers? Michael
On 2010-06-29 14:17 +0200 Michael Franzl wrote:> Another suggestion from me ;) > > Sometimes web developers want to make the format of an html element > dependent on the content of the element. For example you have a menu > with two entries, and you want each entry have a different color (say > "summer" should be red, "winter" should be blue, etc.). This is not > possible in an automatically generated menu, without id or class > attributes set. > > Would it be possible to add an id or class attribute also to menu > entries (li and span), as it is done in headers?This is already possible: just use the `link_attrs` meta information key to set a class for automatically generated links to a page. Then you can use hierarchical CSS tags to only style, for example, a link/span when it appears in a menu. For example, a link to the following `src/index.page`: --- title: Test in_menu: true link_attrs: class: hallo --- Just a test would generate the following link (or span): <a class="hallo">Test</a> As you can see, the generated link has the `hallo` class set. If such a link is generated for a menu, you could use the following CSS rules to style the link differently (if the generated menu is wrapped in an element with the id `menu`): #menu a.hallo, #menu span.hallo { color: blue; } Best regards, Thomas