Fix Docs relative trailing backlash bug (#18244)

Signed-off-by: UltralyticsAssistant <web@ultralytics.com>
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-12-15 19:46:56 +01:00 committed by GitHub
parent b64508338f
commit 626e42ef25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View file

@ -24,6 +24,7 @@ Note:
- This script is built to be run in an environment where Python and MkDocs are installed and properly configured. - This script is built to be run in an environment where Python and MkDocs are installed and properly configured.
""" """
import json
import os import os
import re import re
import shutil import shutil
@ -38,6 +39,13 @@ DOCS = Path(__file__).parent.resolve()
SITE = DOCS.parent / "site" 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): def prepare_docs_markdown(clone_repos=True):
"""Build docs using mkdocs.""" """Build docs using mkdocs."""
if SITE.exists(): if SITE.exists():
@ -284,6 +292,7 @@ def main():
print(f"Building docs from {DOCS}") print(f"Building docs from {DOCS}")
subprocess.run(f"mkdocs build -f {DOCS.parent}/mkdocs.yml --strict", check=True, shell=True) subprocess.run(f"mkdocs build -f {DOCS.parent}/mkdocs.yml --strict", check=True, shell=True)
remove_macros() remove_macros()
create_vercel_config()
print(f"Site built at {SITE}") print(f"Site built at {SITE}")
# Update docs HTML pages # Update docs HTML pages

View file

@ -30,7 +30,7 @@
<button <button
onclick="window.open('https://www.ultralytics.com/events/yolovision', '_blank')" onclick="window.open('https://www.ultralytics.com/events/yolovision', '_blank')"
> >
Register now Join now
</button> </button>
</div> </div>
</div> </div>

View file

@ -15,6 +15,7 @@ repo_name: ultralytics/ultralytics
remote_name: https://github.com/ultralytics/docs remote_name: https://github.com/ultralytics/docs
docs_dir: "docs/en/" # where to find the markdown files docs_dir: "docs/en/" # where to find the markdown files
site_dir: "site/" # where to publish to site_dir: "site/" # where to publish to
use_directory_urls: true # don't display 'index.html' in slugs
# Theme customization # Theme customization
theme: theme:
@ -570,10 +571,10 @@ nav:
- object_counter: reference/solutions/object_counter.md - object_counter: reference/solutions/object_counter.md
- parking_management: reference/solutions/parking_management.md - parking_management: reference/solutions/parking_management.md
- queue_management: reference/solutions/queue_management.md - queue_management: reference/solutions/queue_management.md
- region_counter: reference/solutions/region_counter.md
- solutions: reference/solutions/solutions.md - solutions: reference/solutions/solutions.md
- speed_estimation: reference/solutions/speed_estimation.md - speed_estimation: reference/solutions/speed_estimation.md
- streamlit_inference: reference/solutions/streamlit_inference.md - streamlit_inference: reference/solutions/streamlit_inference.md
- region_counter: reference/solutions/region_counter.md
- trackzone: reference/solutions/trackzone.md - trackzone: reference/solutions/trackzone.md
- trackers: - trackers:
- basetrack: reference/trackers/basetrack.md - basetrack: reference/trackers/basetrack.md