hugo/hugolib
bep d013edb7f8 Implement HasMenuCurrent and IsMenuCurrent for Nodes
Prior to this commit, `HasMenuCurrent` and `IsMenuCurrent` on `Node` always returned false.

This made it hard (if possible at all) to mark the currently selected menu item/group for non-Page content (home page, category pages etc.), i.e. for menus defined in the site configuration.

This commit provides an implementation of these two methods.

Notable design choices:

* These menu items have a loose coupling to the the resources they navigate to; the `Url` is the best common identificator. To facilitate a consistent matching, and to get it in line with the menu items connected to `Page`, relative Urls (Urls starting with '/') for menu items in the site configuration are converted to permaLinks using the same rules used for others’.
* `IsMenuCurrent` only looks at the children of the current node; this is in line with the implementation on `Page`.
* Due to this loose coupling, `IsMenuCurrent` have to search downards in the tree to make sure that the node is inside the current menu. This could have been made simpler if it could answer `yes` to any match of any menu item matching the current resource.

This commit also adds a set of unit tests for the menu system.

Fixes #367
2014-11-01 22:34:49 -04:00
..
benchmark_test.go
handler_file.go Handler WIP 2014-11-01 12:05:37 -04:00
handler_page.go Handler WIP 2014-11-01 12:05:37 -04:00
handlers.go Handler WIP 2014-11-01 12:05:37 -04:00
menu.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
menu_test.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
node.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
page.go Migrating Hugo to Afero for filesystem calls. 2014-11-01 11:57:29 -04:00
page_permalink_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
page_taxonomy_test.go
page_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
page_time_integration_test.go
pageGroup.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
pageSort.go
path_seperators_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
path_seperators_windows_test.go
permalinks.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
permalinks_test.go
planner.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
redis.cn.md
rss_test.go
shortcode.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
shortcode_test.go add 'width' parameter to 'figure' shortcode 2014-10-15 12:09:26 -04:00
site.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
site_show_plan_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
site_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
site_url_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
siteinfo_test.go
sitemap.go
sitemap_test.go
summary.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
taxonomy.go Sort by title if dates are the same 2014-09-11 17:23:01 -04:00
taxonomy_test.go
template.go Make First accept any int 2014-10-15 12:39:09 -04:00
template_embedded.go add 'width' parameter to 'figure' shortcode 2014-10-15 12:09:26 -04:00
template_test.go Make First accept any int 2014-10-15 12:39:09 -04:00