diff --git a/action_library b/action_library
deleted file mode 120000
index 5271121a6..000000000
--- a/action_library
+++ /dev/null
@@ -1 +0,0 @@
-docs/integration/action_library
\ No newline at end of file
diff --git a/mkdocs.yml b/mkdocs.yml
index 5825a7164..510385415 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -802,6 +802,7 @@ plugins:
xdr/features/investigate/dork_language.md: xdr/features/investigate/events_query_language.md
- redoc
- intakes_by_uuid
+- modules_by_uuid
repo_url: https://github.com/SEKOIA-IO/documentation
site_name: Sekoia.io Documentation
site_url: https://docs.sekoia.io
diff --git a/plugins/modules_by_uuid.py b/plugins/modules_by_uuid.py
new file mode 100644
index 000000000..a155823c2
--- /dev/null
+++ b/plugins/modules_by_uuid.py
@@ -0,0 +1,72 @@
+import re
+import string
+from pathlib import Path
+
+import mkdocs
+from mkdocs.config import Config
+from mkdocs.structure.files import File, Files
+from mkdocs.utils.meta import get_data
+
+
+class ModulesByUUIDPlugin(mkdocs.plugins.BasePlugin):
+ """Reading Markdown files that contains an `uuid` metadata to provide
+ a redirection.
+
+ When such a file is identified, a new
+ `integration/action_library/uuid//uuid/$uuid.md` file is faked
+ which will redirect to it."""
+
+ template = """
+
+
+
+ Redirecting...
+
+
+
+
+
+
+Redirecting...
+
+"""
+
+ _redirection_table: dict[str, str] = {}
+
+ def on_files(self, files: Files, config: Config):
+ for source_file in files:
+ if not source_file.src_path.endswith(".md"):
+ continue
+
+ filename = Path(config["docs_dir"]) / Path(source_file.src_path)
+ try:
+ with filename.open() as f:
+ _, metadata = get_data(f.read())
+ except:
+ # File may have been generated by an other plugin
+ continue
+
+ if (
+ "uuid" not in metadata
+ or metadata.get("type").lower() != "playbook"
+ or not source_file.url.startswith("integration/action_library/")
+ ):
+ continue
+
+ self._redirection_table[metadata["uuid"]] = source_file.url
+
+ files._files.append(
+ File(
+ path=f"integration/action_library/uuid/{metadata['uuid']}.md",
+ src_dir="integration/action_library/uuid",
+ dest_dir=config["site_dir"],
+ use_directory_urls=True,
+ )
+ )
+
+ def on_page_read_source(self, page, config):
+ if page.file.src_path.startswith("integration/action_library/uuid/"):
+ if page.file.name in self._redirection_table:
+ return self.template.format(
+ destination=self._redirection_table[page.file.name]
+ )
diff --git a/pyproject.toml b/pyproject.toml
index b042f5ff0..8ffefbd73 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,6 +10,7 @@ packages = [
[tool.poetry.plugins."mkdocs.plugins"]
redoc = "plugins.redoc:RedocPlugin"
intakes_by_uuid = "plugins.intakes_by_uuid:IntakesByUUIDPlugin"
+modules_by_uuid = "plugins.modules_by_uuid:ModulesByUUIDPlugin"
[tool.poetry.dependencies]
python = "^3.11"