Skip to content
Snippets Groups Projects
Verified Commit bdfd400e authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Add a script that auto-generates redirects to all workflow pages

parent 49d22a34
No related branches found
No related tags found
1 merge request!316Replace Sphinx with MkDocs
......@@ -17,6 +17,7 @@ vale/styles/*
!vale/styles/config/
!vale/styles/custom/
.DS_Store
wf_redirects.yaml
.idea
.venv
......
"""Generate pages to forward workflow URLs.
This will redirect `/workflow/workflow_name` to `reference/gso/workflow/module/workflow_name`. This is required since
URLs cannot be changed in the GUI.
"""
from pathlib import Path
import yaml
root = Path(__file__).parent.parent.parent
src = root / "gso"
redirect_map = {}
for path in sorted(src.rglob("*.py")):
module_path = path.relative_to(root).with_suffix("")
parts = tuple(module_path.parts)
if parts[-1] == "__init__":
parts = parts[:-1]
elif parts[-1] == "__main__":
continue
if len(parts) == 4 and "workflows" in parts:
redirect_map["workflow/" + parts[3] + "/index.md"] = "https://docs.gap.geant.org/reference/" + "/".join(parts)
with open(root / "wf_redirects.yaml", 'w') as redirect_file:
file_content = {
"plugins":
[
"search",
{"gen-files": {"scripts": ["docs/scripts/gen_ref_pages.py"]}},
{"redirects": {"redirect_maps": redirect_map}},
{"literate-nav": {"nav_file": "SUMMARY.md"}},
"mkdocstrings",
]
}
yaml.dump(file_content, redirect_file)
INHERIT: wf_redirects.yaml
# General
site_name: GÉANT Automation Platform
site_url: https://docs.gap.geant.org/
......@@ -44,15 +45,6 @@ theme:
extra_css:
- assets/stylesheets/extra.css
plugins:
- search
- gen-files:
scripts:
- docs/scripts/gen_ref_pages.py
- literate-nav:
nav_file: SUMMARY.md
- mkdocstrings
# Page tree
nav:
- Home: index.md
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment