From c80d8c52be4755e81e334e45b02ecfd08fec4b98 Mon Sep 17 00:00:00 2001 From: Andy Damevin Date: Mon, 15 Apr 2024 11:06:07 +0200 Subject: [PATCH] Make Qute doc more intuitive --- docs/src/main/asciidoc/qute.adoc | 42 ++++++++++++++++++++++++-------- docs/src/main/asciidoc/web.adoc | 2 +- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/docs/src/main/asciidoc/qute.adoc b/docs/src/main/asciidoc/qute.adoc index 8343262a59aae..d62aa854b9714 100644 --- a/docs/src/main/asciidoc/qute.adoc +++ b/docs/src/main/asciidoc/qute.adoc @@ -26,10 +26,14 @@ Clone the Git repository: `git clone {quickstarts-clone-url}`, or download an {q The solution is located in the `qute-quickstart` link:{quickstarts-tree-url}/qute-quickstart[directory]. -[[hello-qute-web]] -== Hello World with Qute Web +[[serving-templates]] +== Serving Qute templates via http + +If you want to serve your templates via http: + +1. The Qute Web extension allows you to directly serve via http templates located in `src/main/resource/templates/pub/`. In that case you don't need any Java code to "plug" the template, for example, the template `src/main/resource/templates/pub/foo.html` will be served from the paths `/foo` and `/foo.html` by default. +2. For finer control, you can combine it with Quarkus REST or Quarkus RESTEasy to control how your template will be served. All files located in the `src/main/resources/templates` directory and its subdirectories are registered as templates and can be injected in a REST resource. -If you want to use Qute in your Quarkus Web application, add the Qute Web extension first: [source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] .pom.xml ---- @@ -38,16 +42,19 @@ If you want to use Qute in your Quarkus Web application, add the Qute Web extens quarkus-qute-web ---- -+ + [source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"] .build.gradle ---- implementation("io.quarkiverse.qute.web:quarkus-qute-web") ---- -All files located in the `src/main/resources/templates` directory and its subdirectories are registered as templates. Templates are validated during startup and watched for changes in the development mode. +NOTE: The Qute Web extension is still using the quarkiverse group-id, it is part of the Quarkus platform (so it's is included in the bom), we are working on moving it to Quarkus Core. + +[[hello-qute-web]] +=== Serving Hello World with Qute -Now, let's start with a Hello World html template: +Let's start with a Hello World template: .src/main/resources/templates/pub/hello.html [source] @@ -60,14 +67,29 @@ NOTE: Templates located in the `pub` directory are served via HTTP. Automaticall If your application is running, you can open your browser and hit: http://localhost:8080/hello?name=Martin -For more information about Qute Web, see the https://docs.quarkiverse.io/quarkus-qute-web/dev/index.html[Qute Web guide]. +For more information about Qute Web options, see the https://docs.quarkiverse.io/quarkus-qute-web/dev/index.html[Qute Web guide]. [[hello-qute-rest]] -== Hello World with Jakarta REST +=== Hello Qute and REST + +For finer control, you can combine Qute Web with Quarkus REST or Quarkus RESTEasy to control how your template will be served -If you want to use Qute in your Jakarta REST application, you still need to add the Qute Web extension first (see <>) and make sure you have the Quarkus REST (formerly RESTEasy Reactive) extension. +[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"] +.pom.xml +---- + + io.quarkus + quarkus-rest + +---- + +[source,gradle,role="secondary asciidoc-tabs-target-sync-gradle"] +.build.gradle +---- +implementation("io.quarkus:quarkus-rest") +---- -Here is a very simple text template: +A very simple text template: .hello.txt [source] diff --git a/docs/src/main/asciidoc/web.adoc b/docs/src/main/asciidoc/web.adoc index c3ecc9b68ed2a..1f58a62ef29fb 100644 --- a/docs/src/main/asciidoc/web.adoc +++ b/docs/src/main/asciidoc/web.adoc @@ -51,7 +51,7 @@ For templating and server-side rendering with Quarkus, there are different engin Qute is designed specifically to meet the Quarkus needs, and help you deal with templates, snippets, and partials and render the data from your storage. It is inspired by the most famous template engines, it is fast, type-safe, works in native, and has a lot of nice features. -To install Qute Web, follow xref:qute.adoc[the instructions]. +To install Qute Web, follow xref:qute.adoc#serving-templates[the instructions]. Here is a simple example of a Qute template: