Quarkus Roq Plugins
Roq Plugin Tagging
This plugin allows to generate a dynamic (derived) collection based on a given collection tags.
To install it add:
<dependency>
<groupId>io.quarkiverse.roq</groupId>
<artifactId>quarkus-roq-plugin-tagging</artifactId>
<version>1.0.0.CR2</version>
</dependency>
For example, let’s consider the posts collection, if multiple posts have tags: guide
, then we would generate a /posts/tag/guide
page for all the posts containing the guide
tag. This works for any collection.
To enable tagging, create a layout template, add tagging: [collection id]
in FM. As a result you will have access to a new derived collection named tagCollection
. It is available through site.collections.get(page.data.tagCollection)
:
---
layout: main
tagging: posts
---
{#for post in site.collections.get(page.data.tagCollection)}
{post.title}
{/for}
This also support pagination like any other collection, as tagging is already specifying the target collection, pagination can be enabled just with in FM paginate: true
:
---
layout: main
tagging: posts
paginate: true
---
{#for post in site.collections.get(page.data.tagCollection).paginated(page.paginator)}
{post.title}
{/for}
Roq Plugin Aliases
This plugin allows creating one or many aliases (redirections) for a page.
To install it, add the following code to your dependencies file:
<dependency>
<groupId>io.quarkiverse.roq</groupId>
<artifactId>quarkus-roq-plugin-aliases</artifactId>
<version>1.0.0.CR2</version>
</dependency>
For example, consider that you want to create a shortened link for your post.
To create an alias, create a page and add aliases: [your-alias-here, another-alias-here]
in the Front Matter (FM). As a result, you will have the possibility to access the page using a customized URL as alias.
---
layout: post
title: "Welcome to Roq!"
date: 2024-08-29 13:32:20 +0200
description: This is the first article ever made with Quarkus Roq
img: posts/2024/08/blogging.jpg
tags: blogging
author: ia3andy
aliases: [first-roq-article-ever]
---
Now, when you access the URL http://localhost:8081/first-roq-article-ever
, you will be redirected to the 2024-08-29-welcome-to-roq
blog post.
you can use link templating in aliases |