diff --git a/docs/build_docs.py b/docs/build_docs.py index 9556415c..556149fc 100644 --- a/docs/build_docs.py +++ b/docs/build_docs.py @@ -24,6 +24,7 @@ Note: - This script is built to be run in an environment where Python and MkDocs are installed and properly configured. """ +import json import os import re import shutil @@ -38,6 +39,13 @@ DOCS = Path(__file__).parent.resolve() SITE = DOCS.parent / "site" +def create_vercel_config(): + """Create vercel.json in the site directory with customized configuration settings.""" + config = {"trailingSlash": True} + with open(SITE / "vercel.json", "w") as f: + json.dump(config, f, indent=2) + + def prepare_docs_markdown(clone_repos=True): """Build docs using mkdocs.""" if SITE.exists(): @@ -284,6 +292,7 @@ def main(): print(f"Building docs from {DOCS}") subprocess.run(f"mkdocs build -f {DOCS.parent}/mkdocs.yml --strict", check=True, shell=True) remove_macros() + create_vercel_config() print(f"Site built at {SITE}") # Update docs HTML pages diff --git a/docs/overrides/main.html b/docs/overrides/main.html index 18305746..233aec09 100644 --- a/docs/overrides/main.html +++ b/docs/overrides/main.html @@ -30,7 +30,7 @@ diff --git a/mkdocs.yml b/mkdocs.yml index 3ca385d7..24e74716 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -15,6 +15,7 @@ repo_name: ultralytics/ultralytics remote_name: https://github.com/ultralytics/docs docs_dir: "docs/en/" # where to find the markdown files site_dir: "site/" # where to publish to +use_directory_urls: true # don't display 'index.html' in slugs # Theme customization theme: @@ -570,10 +571,10 @@ nav: - object_counter: reference/solutions/object_counter.md - parking_management: reference/solutions/parking_management.md - queue_management: reference/solutions/queue_management.md + - region_counter: reference/solutions/region_counter.md - solutions: reference/solutions/solutions.md - speed_estimation: reference/solutions/speed_estimation.md - streamlit_inference: reference/solutions/streamlit_inference.md - - region_counter: reference/solutions/region_counter.md - trackzone: reference/solutions/trackzone.md - trackers: - basetrack: reference/trackers/basetrack.md