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.
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
- 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=
Last modified 2 years ago.