This is an automated email from the ASF dual-hosted git repository.
benweidig pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tapestry-5-site-builder.git
The following commit(s) were added to refs/heads/main by this push:
new 0b8fd8f feat(antora): support static files
0b8fd8f is described below
commit 0b8fd8f18f253765154e12545de750f7070930a8
Author: Ben Weidig <[email protected]>
AuthorDate: Sat Oct 24 12:07:40 2026 +0200
feat(antora): support static files
---
antora-playbook-local.yml | 4 ++++
antora-playbook.yml | 1 +
lib/static-files-extension.js | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+)
diff --git a/antora-playbook-local.yml b/antora-playbook-local.yml
index 9f80254..7f0fb9b 100644
--- a/antora-playbook-local.yml
+++ b/antora-playbook-local.yml
@@ -39,3 +39,7 @@ ui:
url:
https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable
snapshot: true
supplemental_files: ./supplemental-ui
+
+antora:
+ extensions:
+ - require: ./lib/static-files-extension
diff --git a/antora-playbook.yml b/antora-playbook.yml
index 23da625..fd6e029 100644
--- a/antora-playbook.yml
+++ b/antora-playbook.yml
@@ -37,6 +37,7 @@ ui:
antora:
extensions:
+ - require: ./lib/static-files-extension
- require: '@antora/lunr-extension'
index_latest_only: true
index_by_heading: true
diff --git a/lib/static-files-extension.js b/lib/static-files-extension.js
new file mode 100644
index 0000000..c62cf3c
--- /dev/null
+++ b/lib/static-files-extension.js
@@ -0,0 +1,34 @@
+/*
+= Extension for publishing static files as-is
+
+Publishes every file below `static/` in the content repository's `main`
+component to the site root, keeping its path relative to `static/`.
+
+Antora only publishes files inside a module family, and those always end up
+below `<component>/<version>/`. Files that must stay at fixed root URLs, like
+the template schemas, DTDs, or the archetype catalog, can't be published that
+way.
+
+== Example
+static/schema/tapestry_5_4.xsd -> /schema/tapestry_5_4.xsd
+
+based on the example https://docs.antora.org/antora/latest/extend/extensions/
+*/
+
+const COMPONENT_NAME = 'main';
+const STATIC_DIR = 'static/';
+
+module.exports.register = function () {
+ this.once('contentAggregated', ({ contentAggregate, siteCatalog }) => {
+ contentAggregate
+ .filter((componentVersion) => componentVersion.name ===
COMPONENT_NAME)
+ .forEach((componentVersion) => {
+ componentVersion.files = componentVersion.files.filter((file)
=> {
+ if (!file.path.startsWith(STATIC_DIR)) return true
+ file.out = { path: file.path.slice(STATIC_DIR.length) }
+ siteCatalog.addFile(file)
+ return false
+ })
+ })
+ })
+}