diff --git a/blog/src/test/java/io/quarkiverse/roq/it/RoqTest.java b/blog/src/test/java/io/quarkiverse/roq/it/RoqTest.java index dda4194e..ecbc3f86 100644 --- a/blog/src/test/java/io/quarkiverse/roq/it/RoqTest.java +++ b/blog/src/test/java/io/quarkiverse/roq/it/RoqTest.java @@ -12,7 +12,7 @@ public class RoqTest { @Test public void testIndex() { given().when().get("/").then().statusCode(200).body(containsString( - "I provide you with all the tools to generate static websites out of your Quarkus web application.")) + "I provide you with all the tools to generate static websites out of your Quarkus web application.")) .body(containsString("Hello, world! I'm Roq")).body(containsString("minute read")) .body(containsString("Page 1 of")).body(containsString("2024 © ROQ")); } @@ -25,7 +25,7 @@ public void testTag() { @Test public void testPosts() { given().when().get("/posts/2024-08-29-welcome-to-roq").then().statusCode(200).body(containsString( - "I provide you with all the tools to generate static websites out of your Quarkus web application.")) + "I provide you with all the tools to generate static websites out of your Quarkus web application.")) .body(containsString("

Hello folks,

")) .body(containsString("

Welcome to Roq!

")) .body(containsString("2024 © ROQ")); @@ -34,17 +34,14 @@ public void testPosts() { @Test public void testPage() { given().when().get("/events").then().statusCode(200).body(containsString( - "I provide you with all the tools to generate static websites out of your Quarkus web application.")) + "I provide you with all the tools to generate static websites out of your Quarkus web application.")) .body(containsString("

Roq 1.0 Beta

")) .body(containsString("2024 © ROQ")); } @Test public void testAlias() { - given().when().get("/first-roq-article-ever").then().statusCode(200).body(containsString( - "I provide you with all the tools to generate static websites out of your Quarkus web application.")) - .body(containsString("

Hello folks,

")) - .body(containsString("

Welcome to Roq!

")) - .body(containsString("2024 © ROQ")); + given().when().get("/first-roq-article-ever").then().statusCode(200) + .body(containsString("url=\"/posts/2024-08-29-welcome-to-roq\"")); } } diff --git a/plugin/aliases/deployment/src/main/java/io/quarkiverse/roq/plugin/aliases/deployment/RoqPluginAliasesProcessor.java b/plugin/aliases/deployment/src/main/java/io/quarkiverse/roq/plugin/aliases/deployment/RoqPluginAliasesProcessor.java index 5b3f0b7c..7610fb8b 100644 --- a/plugin/aliases/deployment/src/main/java/io/quarkiverse/roq/plugin/aliases/deployment/RoqPluginAliasesProcessor.java +++ b/plugin/aliases/deployment/src/main/java/io/quarkiverse/roq/plugin/aliases/deployment/RoqPluginAliasesProcessor.java @@ -57,7 +57,7 @@ public void consumeTemplates( for (String alias : aliasesName) { String aliasLink = TemplateLink.pageLink(config.rootPath(), alias, new TemplateLink.PageLinkData( item.raw().info(), item.raw().collection(), item.data())); - aliasMap.put(aliasLink, url.path()); + aliasMap.put(aliasLink, url.absolute()); } } @@ -81,7 +81,7 @@ public void createVertxRedirects( for (RoqFrontMatterAliasesBuildItem item : aliases) { routes.produce(RouteBuildItem.builder() .route(httpRootPath.relativePath(item.alias())) - .handler(recorder.addRedirect(item.target())) + .handler(recorder.sendRedirectPage(item.target())) .build()); } } diff --git a/plugin/aliases/runtime/src/main/java/io/quarkiverse/roq/plugin/aliases/runtime/RoqFrontMatterAliasesRecorder.java b/plugin/aliases/runtime/src/main/java/io/quarkiverse/roq/plugin/aliases/runtime/RoqFrontMatterAliasesRecorder.java index bd6de3e0..37e0da5a 100644 --- a/plugin/aliases/runtime/src/main/java/io/quarkiverse/roq/plugin/aliases/runtime/RoqFrontMatterAliasesRecorder.java +++ b/plugin/aliases/runtime/src/main/java/io/quarkiverse/roq/plugin/aliases/runtime/RoqFrontMatterAliasesRecorder.java @@ -1,5 +1,8 @@ package io.quarkiverse.roq.plugin.aliases.runtime; +import java.util.Map; + +import io.quarkus.qute.Qute; import io.quarkus.runtime.annotations.Recorder; import io.vertx.core.Handler; import io.vertx.ext.web.RoutingContext; @@ -7,7 +10,30 @@ @Recorder public class RoqFrontMatterAliasesRecorder { - public Handler addRedirect(String url) { - return ctx -> ctx.redirect(url); + public Handler sendRedirectPage(String url) { + return ctx -> { + // language=html + String html = Qute.fmt(""" + + + + + Redirecting… + + + + + +

Redirecting…

+ Click here if you are not redirected. + + + + """, Map.of("url", url)); + + ctx.response() + .putHeader("content-type", "text/html") + .end(html); + }; } }