diff --git a/static/js/search.js b/static/js/search.js index c255397..57b57ad 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -1,18 +1,13 @@ function filter_name(str) { - str = str.toLowerCase(); if (str.length == 0) { for (let i = 0; i < articles.length; i++) { articles[i].style.display = "block"; } } else { + str = str.toLowerCase(); for (let i = 0; i < articles.length; i++) { - let name = articles[i].getElementsByTagName("h2")[0].innerHTML.toLowerCase(); - if (!name.includes(str)) { - articles[i].style.display = "none"; - } else { - articles[i].style.display = "block"; - } + articles[i].style.display = !articles[i].dataset.title.includes(str) ? "none" : "block"; } } } diff --git a/templates/macros.html b/templates/macros.html index 7b58f9d..522b5c0 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -11,7 +11,7 @@ {% endmacro %} {% macro print_article(page) %} -
+

{{ page.title }}

{{ page.summary | safe }}

{{ self::page_info(page=page) }}