diff --git a/index.php b/index.php index 3ab71dd..d53cce9 100644 --- a/index.php +++ b/index.php @@ -231,12 +231,20 @@ if (($_GET['param'] && isset($_GET['search'])) || isset($_GET['tags'])) { $content = file_get_contents($path . '.md'); - - if ((isset($_GET['search']) && !str_contains(strtolower($content), strtolower($param)) && !str_contains(strtolower($name), strtolower($param))) - || (isset($_GET['tags']) && !preg_match('/tags:.*' . $param . '/i', $content))) + if ( + // param does not match content or title + (isset($_GET['search']) && !str_contains(strtolower($content), strtolower($param)) && !str_contains(strtolower($name), strtolower($param))) || + // param does not match tags + (isset($_GET['tags']) && !preg_match('/tags:.*' . $param . '/i', $content)) + ) { continue; } + else if (isset($_GET['search']) && $param == $name) + { + header('Location: index.php?open=true¶m=' . urlencode($name)); + die(); + } } echo '
' . $name .''; if (isset($content) && isset($_GET['tags']))