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 created: 20220809132350 forward: 00001006020000 00001006034000 00001006035500 00001007040310 00001007700000 00001012051400 lang: en license: EUPL-1.2-or-later modified: 20240219161800 published: 20240219161800 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]] ""#search"", ordered by title specify the following query transclude element: ```{="zmk"} {{{query:tags:#search ORDER title}}} ``` This will result in: :::{="example"} * [[Formal syntax of query expressions|00001007780000]] * [[Query Directives|00001007720000]] * [[Query Expression|00001007700000]] * [[Query: Action List|00001007770000]] * [[Query: Context Directive|00001007720300]] * [[Query: Ident Directive|00001007720600]] * [[Query: Items Directive|00001007720900]] * [[Query: List of Zettel Identifier|00001007710000]] * [[Query: Search Expression|00001007701000]] * [[Search operator|00001007705000]] * [[Search term|00001007702000]] * [[Search value|00001007706000]] * [[Useful query expressions|00001007790000]] * [[Zettelmarkup: Query Transclusion|00001007031140]] ::: 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: ; ''N'' (or any word that starts with ""''N''"" (parameter) : The resulting list will be a numbered list. ; ''MINn'' (parameter) : Emit only those values with at least __n__ aggregated values. __n__ must be a positive integer, ''MIN'' must be given in upper-case letters. ; ''MAXn'' (parameter) : Emit only those values with at most __n__ aggregated values. __n__ must be a positive integer, ''MAX'' must be given in upper-case letters. ; ''TITLE'' (parameter) : All words following ''TITLE'' are joined together to form a title. It is used for the ''ATOM'' and ''RSS'' action. ; ''ATOM'' (aggregate) : Transform the zettel list into an [[Atom 1.0|https://www.rfc-editor.org/rfc/rfc4287]]-conformant document / feed. The document is embedded into the referencing zettel. ; ''RSS'' (aggregate) : Transform the zettel list into a [[RSS 2.0|https://www.rssboard.org/rss-specification]]-conformant document / feed. The document is embedded into the referencing zettel. ; ''KEYS'' (aggregate) : Emit a list of all metadata keys, together with the number of zettel having the key. ; ''REDIRECT'', ''REINDEX'' (aggregate) : Will be ignored. These actions may have been copied from an existing [[API query call|00001012051400]] (or from a WebUI query), but are here superfluous (and possibly harmful). ; Any [[metadata key|00001006020000]] of type [[Word|00001006035500]] or of type [[TagSet|00001006034000]] (aggregates) : Emit an aggregate of the given metadata key. The key can be given in any letter case[^Except if the key name collides with one of the above names. In this case use at least one lower case letter.]. 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: ```{="zmk"} {{{query:tags:#search | tags}}} ``` This is a tag cloud of all tags that are used together with the tag #search: :::{="example"} [[#example|query:tags:#search tags:#example]]^^1^^ [[#manual|query:tags:#search tags:#manual]]^^14^^ [[#reference|query:tags:#search tags:#reference]]^^1^^ [[#search|query:tags:#search tags:#search]]^^14^^ [[#zettelmarkup|query:tags:#search tags:#zettelmarkup]]^^1^^ [[#zettelstore|query:tags:#search tags:#zettelstore]]^^14^^ :::