What is the code for a page result similar to a ๐Ÿ“Œ tag search?

I need to query all objects related to this project on the project page, which might include pages or paragraphs, etc. Currently,

Iโ€™m using the following method to query different objects:

task where tags = "{{@page.name}}"
render [[Library/Core/Query/Task]]
item where tags = "{{@page.name}}"
render [[Library/Core/Query/tags]]
paragraph where tags = "{{@page.name}}"
render [[Library/Core/Query/tags]]
page where tags = "{{@page.name}}"
render [[Library/Core/Query/Page]]

However, this approach seems clumsy as I have to manually search for all objects. I realized that what I need is a display similar to the :pushpin: tag search page that automatically shows all related results without displaying objects that were not found.

Since Iโ€™m not very proficient in English and coding, I mostly rely on translation software and ChatGPT for help. If someone is willing to provide some key information and ideas, I would be able to try solving my requirements myself. Thank you very much :pray:

The source code for that virtual page is here: silverbullet/plugs/index/tag_page.ts at 95ae722a5055b8063d6b40113207261d3ea77e10 ยท silverbulletmd/silverbullet ยท GitHub

Itโ€™s basically what youโ€™ve written out but each section is surrounded by #if blocks

Thank you very much! :grinning:
with your tips and the help of ChatGPT, I have achieved what I need. My final code looks like this:

```template
{{#let @tasks = {task where tags = @page.name}}}
{{#if @tasks}}
{{#each @tasks}}
* [{{state}}] {{name}}  [[{{ref}}]]  
{{/each}}
{{/if}}
{{/let}}

You got ChatGPT to write SilverBullet template code? How did you prompt it?

I got a lot of code from Gemini :wink:

In fact, I donโ€™t have a special prompt. :joy:
I just give these instructions and codes to AI as a reference:

  1. Template Language
  2. tag_page.ts code
  3. Mentions Widget code
  4. My query code

Then tell it that I need code like Linked Mentions Widget and tag_page.ts that will only be displayed when the query has results.