Documentation

Learn to dance with the Banana!

Named Routes

Named routes are basically "shortcuts" to pages. They allow you to link to a page without directly linking to a page.

Creating a Named Route

  • Open the "wiki/config/named_routes.php" file.
  • Create a key/value entry in the array.
    • The key is the name of the route.
    • The value is link.

Example:


return array(
    'named_routes' => 'Build/Named_Routes.md',
    'pages' => 'Build/Pages.md',
    'banana_dance' => 'http://www.bananadance.org',
);

You can now link to any of these named routes on any page:

<a href="http://www.yourwiki.com/?l=pages">My Page Route</a>

Or using markdown syntax:

[My Page Route](?l=pages)

When clicked, this link will redirect the user to "?p=Pages.md&c=Build".

Benefits of Named Routes

If you change a file name or change the structure of your wiki, you only need to update your named route file to update the link across your wiki. This means you don't need to manually go through all of your pages to edit hard coded links.

For example, presume I wanted to move the "Build/Pages.md" file to "Pages/Overview.md". As long as I had the named route listed in the example above, all I would need to do is update the named_routes.php file to reflect the new location of the page. Any existing link that used the named route would now redirect the user to the new location without me ever having to edit an actual wiki page.

Notes

  • All links that start with "http" will be considered external links. All others will be considered internal to your wiki.
  • Use named routes in your page by using the "key" in the "l" (lower case "L") parameter of a link (example: index.php?l=named_route_key).

Last modified 2 years ago.