diff --git a/libs/functions.php b/libs/functions.php
index c65fafc..62139ee 100644
--- a/libs/functions.php
+++ b/libs/functions.php
@@ -73,7 +73,7 @@
function directory_tree($dir, $ignore) {
global $base_doc, $multilanguage, $output_language;
$tree = array();
- $Item = array_diff(scandir($dir), array(".", "..", "index.md"));
+ $Item = array_diff(scandir($dir), array(".", ".."));
foreach ($Item as $key => $value) {
if (is_dir($dir . '/' . $value)) {
if (!in_array($value, $ignore['folders']))
@@ -115,7 +115,13 @@
$return .= "
";
+ $link = "#";
+ $nav_class = "aj-nav ";
+ if(in_array("index.md", $node)) {
+ $link = $t . clean_url($key, $mode);
+ $nav_class = "";
+ }
+ $return .= "";
$return .= clean_url($key, "Title");
$return .= "";
$return .= "";
@@ -124,7 +130,7 @@
$return .= "
";
$return .= "";
}
- else {
+ else if($node !== "index.md") {
$return .= "Oh No. That page doesn't exist";
$options['file_editor'] = false;
} else {
- $page['path'] = str_replace($docs_path . '/', "", $file);
+ $page['path'] = $file_relative_path;
$page['markdown'] = file_get_contents($file);
$page['modified'] = filemtime($file);
$page['content'] = MarkDownExtended($page['markdown']);
@@ -184,8 +190,11 @@
return $url;
case 'Title':
case 'Filename':
- $t = substr_count($url, '/');
- if ($t > 0) $url = substr(strrchr($url, "/"), 1);
+ $parts = array_reverse(explode('/', $url));
+ if (isset($parts[0])) {
+ if ($parts[0] === "index.md" && isset($parts[1])) $url = $parts[1];
+ else $url = $parts[0];
+ }
$url = explode('_', $url);
if (isset($url[0]) && is_numeric($url[0])) unset($url[0]);
if ($mode === 'Filename') $url = implode('_', $url);
diff --git a/libs/live.php b/libs/live.php
index b5546f6..3ba2e66 100644
--- a/libs/live.php
+++ b/libs/live.php
@@ -51,6 +51,7 @@
$file .= '/' . $dirs[$key];
$tree = $tree[$dirs[$key]];
}
+ if (is_file($file . "/index.md")) $file = $file . "/index.md";
return $file;
}
}