$app->get('/blog/', $blog)->value('page', '1'); $app->get('/blog/page/{page}/', $blog); $app->get('/blog/{postslug}/', function ($postslug) use($app) { $data = collection("posts")->findOne(["Title_slug" => $postslug]); if ($data === null) { $app->abort(404, "Post '{$postslug}' does not exist."); } return $app['twig']->render('post.twig', array('data' => $data)); }); $app->get('/portfolio/', function () use($app) { $data = gallery("Portfolio"); d($data); return $app['twig']->render('gallery.twig', array('data' => $data)); }); $app->get('/cv/', function () use($app) { $content = Cms::curlGet(CV_URL . ".md"); $content = cockpit("cockpit")->markdown($content); $content = Cms::cleanHtml($content); $data = ["Title" => "Curriculum Vitae", "Subtitle" => "Lorem ipsum", "content" => "<section class='cv'>" . $content . "</section>"]; d($data); return $app['twig']->render('page.twig', array('data' => $data)); }); $app->get('/{pageslug}/', function ($pageslug) use($app) { $data = collection("Pages")->findOne(["Title" => $pageslug]); if ($data === null) { $data = collection("Pages")->findOne(["Title_slug" => $pageslug]); } if ($data === null) { $app->abort(404, "Page '{$pageslug}' does not exist."); } return $app['twig']->render('page.twig', array('data' => $data));