diff --git a/system/admin/views/layout.html.php b/system/admin/views/layout.html.php index 4a92e17..f467c5a 100644 --- a/system/admin/views/layout.html.php +++ b/system/admin/views/layout.html.php @@ -4,7 +4,9 @@ <?php echo $title;?> - + + + diff --git a/system/htmly.php b/system/htmly.php index 73e4cbb..30e52e2 100644 --- a/system/htmly.php +++ b/system/htmly.php @@ -1301,14 +1301,20 @@ get('/search/:keyword', function ($keyword) { $posts = get_keyword($keyword, $page, $perpage); - $total = keyword_count($keyword); - - if (empty($posts) || $page < 1) { - // a non-existing page - render('404-search', null, false); + if (!$posts || $page < 1) { + // a non-existing page or no search result + render('404-search', array( + 'title' => 'Search results not found! - ' . blog_title(), + 'description' => '', + 'breadcrumb' => '' . config('breadcrumb.home') . ' » No search results', + 'canonical' => site_url() . 'search/' . strtolower($keyword), + 'bodyclass' => 'error-404-search', + )); die; } + $total = keyword_count($keyword); + render('main', array( 'title' => 'Search results for: ' . tag_i18n($keyword) . ' - ' . blog_title(), 'description' => 'Search results for: ' . tag_i18n($keyword) . ' on ' . blog_title() . '.', diff --git a/system/includes/functions.php b/system/includes/functions.php index c20a0c3..928f4d4 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -654,13 +654,7 @@ function get_keyword($keyword, $page, $perpage) } } - if (empty($tmp)) { - // a non-existing page - render('404-search', null, false); - die; - } - - return $tmp = get_posts($tmp, $page, $perpage); + return ($tmp) ? get_posts($tmp, $page, $perpage) : []; } // Get related posts base on post tag. @@ -1543,7 +1537,13 @@ EOF; function not_found() { header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found"); - render('404', null, false); + render('404', array( + 'title' => 'This page doesn\'t exist! - ' . blog_title(), + 'description' => '', + 'canonical' => false, + 'breadcrumb' => '' . config('breadcrumb.home') . ' » 404 Not Found', + 'bodyclass' => 'error-404', + )); die(); } diff --git a/themes/blog/404-search.html.php b/themes/blog/404-search.html.php index 041f867..c7b1972 100644 --- a/themes/blog/404-search.html.php +++ b/themes/blog/404-search.html.php @@ -1,21 +1,16 @@ - - - - - - - - Search results not found! - <?php echo blog_title() ?> - - - - -
-

Search results not found!

-
- + + + +
+
+
+
+

Search results not found!

+

Please search again, or would you like to try our homepage instead?

+
+ +
+
+
-

Please search again, or would you like to try our homepage instead?

-
- - \ No newline at end of file + diff --git a/themes/blog/404.html.php b/themes/blog/404.html.php index cf762e1..2f495ce 100644 --- a/themes/blog/404.html.php +++ b/themes/blog/404.html.php @@ -1,18 +1,14 @@ - - - - - - - - 404 Not Found - <?php echo blog_title() ?> - - - - -
-

This page doesn't exist!

-

Would you like to try our homepage instead?

-
- - \ No newline at end of file + + + +
+
+
+
+

This page doesn't exist!

+

Please search to find what you're looking for or visit our homepage instead.

+ +
+
+
+
\ No newline at end of file diff --git a/themes/blog/layout.html.php b/themes/blog/layout.html.php index d2ca1b9..4b8dd74 100644 --- a/themes/blog/layout.html.php +++ b/themes/blog/layout.html.php @@ -6,7 +6,9 @@ <?php echo $title;?> - + + + diff --git a/themes/clean/404-search.html.php b/themes/clean/404-search.html.php index 2c2485c..ce5ebff 100644 --- a/themes/clean/404-search.html.php +++ b/themes/clean/404-search.html.php @@ -1,21 +1,12 @@ - - - - - - - - Search results not found! - <?php echo blog_title() ?> - - - - -
-

Search results not found!

-