diff --git a/assets/search/js/form.ts b/assets/search/js/form.ts index f2cae138afa..4cda068cce1 100644 --- a/assets/search/js/form.ts +++ b/assets/search/js/form.ts @@ -255,6 +255,7 @@ export default class Form { const taxonomies = this.getTaxonomies() if (query === '' && Object.values(taxonomies).filter((item) => item.length > 0).length == 0) { + this.renderer.clean() this.renderer.renderHistories() return } diff --git a/assets/search/js/renderer.ts b/assets/search/js/renderer.ts index 5082b7ab18b..82a8d65d49b 100644 --- a/assets/search/js/renderer.ts +++ b/assets/search/js/renderer.ts @@ -55,6 +55,7 @@ export default class Renderer { } clean() { + this.results = [] this.getContainer().innerHTML = '' } @@ -211,8 +212,10 @@ export default class Renderer { } renderHistories() { - this.results = [] - this.clean() + if (!params.histories) { + return + } + const histories = Historiographer.get() let html = '' histories.forEach((history) => { diff --git a/hugo.toml b/hugo.toml index c73d2da04f5..7941ca5098f 100644 --- a/hugo.toml +++ b/hugo.toml @@ -50,4 +50,5 @@ expand_results_meta = false lazy_loading = true filter_taxonomies = true filter_years = true +histories = true histories_count = 5 diff --git a/layouts/partials/search/assets/js-resource.html b/layouts/partials/search/assets/js-resource.html index 81724adbf42..ceb5f3a1287 100644 --- a/layouts/partials/search/assets/js-resource.html +++ b/layouts/partials/search/assets/js-resource.html @@ -90,6 +90,7 @@ "icons" $icons "indices" $indices "i18n" $i18n.Values + "histories" (default true site.Params.search.histories) "historiesCount" (default 5 site.Params.search.histories_count) "defaultLang" $defaultLang "langs" $langs.Values