Skip to content

Commit ad95aae

Browse files
authored
Merge pull request #48433 from mkouba/issue-41050
Qute: include - make it possible to supply the template id dynamically
2 parents 07ea9c4 + 5392f99 commit ad95aae

File tree

5 files changed

+289
-135
lines changed

5 files changed

+289
-135
lines changed

docs/src/main/asciidoc/qute-reference.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,15 @@ This section can be used to include another template and possibly override some
11271127
<1> Include a template with id `foo`. The included template can reference data from the current context.
11281128
<2> It's also possible to define optional parameters that can be used in the included template.
11291129

1130+
By default, the first unnamed parameter represents the id of a template that should be included.
1131+
And it is taken as is.
1132+
For example, `{#include bar/foo /}` includes a template with id `bar/foo`; i.e. `src/main/resources/templates/bar/foo.html` could be matched.
1133+
However, it is also possible to supply the template id dynamically.
1134+
Just add the `_id` parameter to the tag.
1135+
In this case, the argument value of the `_id` parameter represents an expression that is resolved and the result represents the template id.
1136+
For example, `{#include _id=bar.foo /}` means that `bar.foo` is first resolved and then the resulting template id is used.
1137+
1138+
11301139
_Template inheritance_ makes it possible to reuse template layouts.
11311140

11321141
.Template "base"

0 commit comments

Comments
 (0)