diff --git a/system/htmly.php b/system/htmly.php index 9e65ee3..a4591e9 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -1547,10 +1547,11 @@ get('/search/:keyword', function ($keyword) { // a non-existing page or no search result render('404-search', array( 'title' => 'Search results not found! - ' . blog_title(), - 'description' => '', + 'description' => 'Search results not found!', 'breadcrumb' => '' . config('breadcrumb.home') . ' » No search results', - 'canonical' => site_url() . 'search/' . strtolower($keyword), + 'canonical' => site_url(), 'bodyclass' => 'error-404-search', + 'is_search' => is_search(true), )); die; } diff --git a/system/includes/functions.php b/system/includes/functions.php index d169764..f2f1d13 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -812,7 +812,8 @@ function get_keyword($keyword, $page, $perpage) } } - return ($tmp) ? get_posts($tmp, $page, $perpage) : []; + return ($tmp) ? get_posts($tmp, $page, $perpage) : []; + } // Get related posts base on post tag. @@ -899,8 +900,7 @@ function get_categorycount($var) // Author string $str = explode('/', $replaced); - $cat = $str[count($str) - 3]; - + $cat = '/blog/' . $str[count($str) - 3]; if (stripos($cat, "$var") !== false) { $tmp[] = $v; } @@ -1755,10 +1755,11 @@ function not_found() header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); render('404', array( 'title' => 'This page doesn\'t exist! - ' . blog_title(), - 'description' => '', - 'canonical' => false, + 'description' => '404 Not Found', + 'canonical' => site_url(), 'breadcrumb' => '' . config('breadcrumb.home') . ' » 404 Not Found', 'bodyclass' => 'error-404', + 'is_notfound' => is_notfound(true), )); die(); } @@ -2275,6 +2276,16 @@ function is_subpage($value = null) } } +// TRUE if the current page is 404 error page. +function is_notfound($value = null) +{ + if (!empty($value)) { + return true; + } else { + return false; + } +} + // Return blog title function blog_title() { diff --git a/themes/blog/layout.html.php b/themes/blog/layout.html.php index 4b8dd74..d2ca1b9 100644 --- a/themes/blog/layout.html.php +++ b/themes/blog/layout.html.php @@ -6,9 +6,7 @@