diff --git a/bundles/docs/routes.php b/bundles/docs/routes.php index e4d1ed5d..1c68d13a 100644 --- a/bundles/docs/routes.php +++ b/bundles/docs/routes.php @@ -17,9 +17,22 @@ Route::get('docs/(:any)/(:any?)', function($section, $page = null) { - $page = rtrim(implode('/', array($section, $page)), '/').'.md'; + $root = path('storage').'documentation/'; - $content = Markdown(file_get_contents(path('storage').'documentation/'.$page)); + $file = rtrim(implode('/', array($section, $page)), '/').'.md'; + + if (file_exists($path = $root.$file)) + { + $content = Markdown(file_get_contents($path)); + } + elseif (file_exists($path = $root.$section.'/home.md')) + { + $content = Markdown(file_get_contents($path)); + } + else + { + return Response::error('404'); + } return View::make('docs::page')->with('content', $content); }); \ No newline at end of file