title: Zettelmarkup: Query Transclusion
role: manual
tags: #manual #search #zettelmarkup #zettelstore
syntax: zmk
back: 00001007031100
backward: 00001006020000 00001007031100 00001012051400
box-number: 1
copyright: (c) 2020-present by Detlef Stern <ds@zettelstore.de>
created: 20220809132350
forward: 00001006020000 00001006034000 00001006035500 00001007040310 00001007700000 00001012051400
lang: en
license: EUPL-1.2-or-later
modified: 20251212134511
published: 20251212134511
visibility: public

A query transclusion is specified by the following sequence, starting at the first position in a line: `{{{query:query-expression}}}`.
The line must literally start with the sequence `{{{query:`.
Everything after this prefix is interpreted as a [query expression](00001007700000).

When evaluated, the query expression is evaluated, often resulting in a list of [links](00001007040310) to zettel, matching the query expression.
The result replaces the query transclusion element.

For example, to include the list of all zettel with the [tags](00001006020000#tags) &ldquo;#search&rdquo;, ordered by title specify the following query transclude element:

    {{{query:tags:#search ORDER title}}}

This will result in:



For example, this allows to create a dynamic list of zettel inside a zettel, maybe to provide some introductory text followed by a list of child zettel.

The query will deliver only those zettel, which the current user is allowed to read.

In the above example, the action list is empty.
This leads to the described list of zettel.

The following actions are supported, parameter and aggregate actions:



To allow some kind of backward compatibility, an action written in uppercase letters that leads to an empty result list, will be ignored.
In this case the list of selected zettel is returned.

Example:

    {{{query:tags:#search | tags}}}

This is a tag cloud of all tags that are used together with the tag #search:

