Closed arky closed 1 year ago
The search results are not built with Hugo and the standard templates.
The Zen theme use Hugo to construct a search index in json format. The search results are built from that json file with javascript.
To change the search results you need to override the "search" shortcut. See the <template>
tag at the bottom of that shortcode.
I have the following code in my 'layouts/shortcodes/search.html'. Modifying the template as follows. Then no search results are shown.
<p class="error message js-hidden">{{ i18n "js_required" }}</p>
<p class="search-loading status message hidden">{{ i18n "search_loading" }}</p>
<div class="search-input hidden">
<form id="search-form" class="search-form" action="#" method="post" accept-charset="UTF-8" role="search">
<label for="query" class="visually-hidden">{{ i18n "search_title" }}</label>
<input type="search" id="query" name="query" class="search-text" placeholder="{{ i18n "search_placeholder" }}" maxlength="128">
<button type="submit" name="submit" class="form-submit" >{{ i18n "search_title" }}</button>
</form>
</div>
<div class="search-results"></div>
<template>
<article class="search-result list-view">
<header>
<h2 class="title"><a href="#">Title here</a></h2>
</header>
<div class="content">Summary here</div>
</article>
</template>
Apprently the search js does not like it when you remove things it assumes are there.
To avoid the need to modify the js as well try this. Instead of removing the div with the date, change the class from "submitted" to "hidden", then it will not show.
Thank you @frjo I think that is a good stop-gap solution for now. I have few ideas for extending search feature in the next release.
The search results doesn't seem to check if
submitted = false
. It will always show submitted dates in search results.Am using following language specific settings in config/_default/languages.toml