Skip to content

Commit

Permalink
Merge pull request #44602 from neon-dev/patch-1
Browse files Browse the repository at this point in the history
Qute docs improvement
  • Loading branch information
mkouba authored Nov 21, 2024
2 parents b8e22a0 + 3e41b3f commit 2c4d218
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/src/main/asciidoc/qute.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ Hello Martin!
There's an alternate way to declare your templates in your Java code, which relies on the following convention:

- Organize your template files in the `/src/main/resources/templates` directory, by grouping them into one directory per resource class. So, if
your `ItemResource` class references two templates `hello` and `goodbye`, place them at `/src/main/resources/templates/ItemResource/hello.txt`
and `/src/main/resources/templates/ItemResource/goodbye.txt`. Grouping templates per resource class makes it easier to navigate to them.
your `FruitResource` class references two templates `apples` and `oranges`, place them at `/src/main/resources/templates/FruitResource/apples.txt`
and `/src/main/resources/templates/FruitResource/oranges.txt`. Grouping templates per resource class makes it easier to navigate to them.
- In each of your resource class, declare a `@CheckedTemplate static class Template {}` class within your resource class.
- Declare one `public static native TemplateInstance method();` per template file for your resource.
- Use those static methods to build your template instances.
Expand All @@ -162,7 +162,7 @@ Hello {name}! <1>
----
<1> `{name}` is a value expression that is evaluated when the template is rendered.

Now let's declare and use those templates in the resource class.
Now let's declare and use this template in the resource class.

.HelloResource.java
[source,java]
Expand Down Expand Up @@ -201,7 +201,7 @@ NOTE: Once you have declared a `@CheckedTemplate` class, we will check that all

Keep in mind this style of declaration allows you to reference templates declared in other resources too:

.HelloResource.java
.GreetingResource.java
[source,java]
----
package org.acme.quarkus.sample;
Expand All @@ -215,8 +215,8 @@ import jakarta.ws.rs.core.MediaType;
import io.quarkus.qute.TemplateInstance;
@Path("goodbye")
public class GoodbyeResource {
@Path("greeting")
public class GreetingResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
Expand Down

0 comments on commit 2c4d218

Please sign in to comment.