Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

61 Commits

Folders and files

Repository files navigation

Quarkus SEO

License

A Quarkus extension that adds search engine and social media output to a web application. It writes meta tags and JSON-LD into the page head. It serves a sitemap and a robots.txt. You add the extension, set the site URL and put one tag in your base template. Every part accepts configuration, a replacement bean or a switch.

Features

  • One Qute tag, {#seo /}, that writes title, description, canonical, hreflang, Open Graph and Twitter tags
  • A request scoped Seo bean that sets values from Java, which win over the values of the tag
  • Typed schema.org builders for JSON-LD, without Jackson
  • A sitemap from configuration, from @SitemapEntry and from your own beans, with an index above 50,000 URLs
  • A robots.txt from rule groups, with presets for AI crawlers
  • Opt-in security.txt, web manifest, IndexNow and llms.txt, all off by default
  • A Dev UI with an overview and a page check that lists content warnings in dev mode
  • No indexing outside the prod profile
  • Optional caching with quarkus-cache
  • Replaceable beans for locales, rendering, the sitemap, robots.txt, the base URL and IndexNow
  • Native image support that needs no configuration

Getting Started

Installation

Add the extension to your Quarkus application.

Maven

<dependency>
    <groupId>org.sitenetsoft</groupId>
    <artifactId>quarkus-seo</artifactId>
    <version>0.1.0</version>
</dependency>

Gradle

implementation("org.sitenetsoft:quarkus-seo:0.1.0")

Set Up a Site

Set the public address of the site in application.properties:

quarkus.seo.site-url=https://example.org
quarkus.seo.site-name=Example

Put the tag in the <head> of your base template:

<head>
  <meta charset="utf-8">
  {#seo /}
</head>

The site now serves /sitemap.xml and /robots.txt. Each page has a title, a canonical link and the social tags.

Set Values for a Page

import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;

import io.quarkus.qute.TemplateInstance;

import org.sitenetsoft.quarkus.seo.Seo;

@Path("/")
public class PageResource {

    @Inject
    Seo seo;

    @GET
    @Path("{slug}")
    @Produces("text/html")
    public TemplateInstance page(@PathParam("slug") String slug) {
        CmsPage page = cms.get(slug);
        seo.title(page.title()).description(page.summary());
        return Templates.page(page);
    }
}

The title template adds the site name. For the title About us, the page title is About us | Example.

Set quarkus.seo.site-url or quarkus.seo.allowed-hosts in production. Without them, the extension builds absolute URLs from the Host header of the request. See The Host header.

Building from Source

Building requires Java 25 and Maven. The artifacts target Java 21. Set JAVA_HOME to a JDK 25.

# Build all modules and run the tests
JAVA_HOME=/path/to/jdk-25 mvn -T 4 verify

# Build the documentation with the generated configuration reference
JAVA_HOME=/path/to/jdk-25 mvn -Pdocs -pl docs -am package

Documentation

Read the full documentation for these guides:

Compatibility

Extension Version Quarkus Version Java Version
0.1.0 3.40.1 21 or later

License

This project uses the Apache License 2.0.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages