diff --git a/brain/controller/IndexControl.inc.php b/brain/controller/IndexControl.inc.php
index e8c7d5e..615c4e6 100644
--- a/brain/controller/IndexControl.inc.php
+++ b/brain/controller/IndexControl.inc.php
@@ -63,17 +63,24 @@ class IndexControl
break;
default:
- //check layout to see what page should be rendered
- $template = $settings["global"]["theme"] . "/page.twig";
+ //check if page is a menu item, if not render along path as usual
+ $page = [];
$book = new Book();
- $page = $book->findPageBySlug($args["third"]);
+ if (is_numeric($args["first"])) {
+ $page = $book->findPageBySlug($args["third"]);
+ } else {
+ $page = $book->findPageBySlug($args["first"]);
+ }
+ $template =
+ $settings["global"]["theme"] . "/" . $page["layout"] . ".twig";
$pageOptions = Sorting::page($page);
break;
}
} else {
//index
- $template = $settings["global"]["theme"] . "/index.twig";
+ $template =
+ $settings["global"]["theme"] . "/" . $page["layout"] . ".twig";
$book = new Book("");
$page = $book->findPageBySlug();
$pageOptions = Sorting::page($page);
@@ -83,6 +90,7 @@ class IndexControl
$response->getBody()->write($html);
return $response;
} else {
+ //if dynamic flag is false, load up html
$view = Twig::fromRequest($request);
$html = file_get_contents("../public/index.html");
$response->getBody()->write($html);
diff --git a/brain/data/Render.inc.php b/brain/data/Render.inc.php
index 251cd30..e3b745d 100644
--- a/brain/data/Render.inc.php
+++ b/brain/data/Render.inc.php
@@ -80,9 +80,15 @@ class Render
$location = "../public/index.html";
$dir = null;
} else {
- $location =
- "../public/" . $page["path"] . "/" . $page["slug"] . ".html";
- $dir = "../public/" . $page["path"];
+ // if page is a menu item, render the page on public root
+ if ($page["menu"] == "true") {
+ $location = "../public/" . $page["slug"] . ".html";
+ $dir = "../public/";
+ } else {
+ $location =
+ "../public/" . $page["path"] . "/" . $page["slug"] . ".html";
+ $dir = "../public/" . $page["path"];
+ }
}
$html = $this->twig->render($template, $pageOptions);
diff --git a/brain/utility/Sorting.inc.php b/brain/utility/Sorting.inc.php
index 0c7b3d5..475a0ca 100644
--- a/brain/utility/Sorting.inc.php
+++ b/brain/utility/Sorting.inc.php
@@ -181,7 +181,11 @@ class Sorting
$limit = 4;
$pages = (new Book())->getContents();
foreach ($pages as $item) {
- if (!$item["deleted"] && $item["published"]) {
+ if (
+ !$item["deleted"] &&
+ $item["published"] &&
+ $item["menu"] != "true"
+ ) {
if (count($recent) < $limit) {
array_push($recent, [
"path" => $item["path"],
diff --git a/content/themes/fipamo-default/frame.twig b/content/themes/fipamo-default/frame.twig
index caa32fc..d16faa3 100644
--- a/content/themes/fipamo-default/frame.twig
+++ b/content/themes/fipamo-default/frame.twig
@@ -36,12 +36,12 @@
{% for link in menu %}
{% if dynamicRender is defined %}
{% if dynamicRender == 'true' %}
-
+
{% else %}
-
+
{% endif %}
{% else %}
-
+
{% endif %}
{% endfor %}