silverbullet icon indicating copy to clipboard operation
silverbullet copied to clipboard

Customize template for search results (enhancement)

Open damufo opened this issue 1 year ago • 1 comments

From https://community.silverbullet.md/t/customize-search-results/235

When file name is not relevant (add image). For example for zettelkasten system.

How can I customize search results?

This is an enhancement request.

It is about allowing to modify the model that shows the searches so that it can show other fields besides the only the file name. It would be to use the name of the file to create the links but it would be better to show the yaml title if it has it and if it doesn't have it it can show the first level 1 header that the document has or show the first x characters of the document, let's imagine a short note without more than a few comments.

Image imaxe

Very thanks.

damufo avatar Feb 24 '24 09:02 damufo

I was thinking of making a few changes to the results page, mostly to show snippets of the found text. Would it be better to offer the ability of specifying a template for the results instead? E.g. in SETTINGS:

searchResultsTemplate: [[Library/Core/Query/SearchResultsPage]]

and then Library/Core/Query/SearchResultsPage:

---
tags: template
description: A search result item
---
## [[{{name}}]] (score {{score}})
> {{snippet}}

justyns avatar Jul 26 '24 06:07 justyns

I think that is a very good solution. The current search page is not usable when filenames are datetimes as zettelkasten for example, 🙁

damufo avatar Nov 18 '24 05:11 damufo

What is the status of this?

damufo avatar Dec 17 '24 10:12 damufo