diff --git a/app/controllers/BlogController.php b/app/controllers/BlogController.php index 23f595e..579261b 100644 --- a/app/controllers/BlogController.php +++ b/app/controllers/BlogController.php @@ -41,7 +41,9 @@ class BlogController extends PageController { LEFT JOIN section ON page.section_id = section.id LEFT JOIN log ON blog_post.log_id = log.id WHERE blog_post.archived = 0 AND - (blog_post.title LIKE :query OR blog_post.tag LIKE :query) + (blog_post.content LIKE :query OR + blog_post.title LIKE :query OR + blog_post.tag LIKE :query) ', [[':query', "%$query%", \PDO::PARAM_STR]]); } diff --git a/public/js/site.js b/public/js/site.js index 13f8273..6f5a13b 100644 --- a/public/js/site.js +++ b/public/js/site.js @@ -19,7 +19,7 @@ $(document).ready(function() { { var url = input.data("url"); var search = input.val(); - window.location.href = url + '?search=' + search; + window.location.href = url + '?search=' + encodeURIComponent(search); } $("#js-blog-search").keydown(function(e) { @@ -37,7 +37,7 @@ $(document).ready(function() { var url = $(this).data("url"); var search = $(this).val(); if (search.length == 0 || search.length >= 3) { - fetch(url + '/search?query=' + search) + fetch(url + '/search?query=' + encodeURIComponent(search)) .then(response => response.text()) .then(data => { $("#blog-posts").empty().append(data);