Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add quick clean up for sidebar and old pages #335

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

MustafaJafar
Copy link
Contributor

@MustafaJafar MustafaJafar commented Feb 7, 2025

Changelog Description

This PR:

Additional Note

I made this script to check for the missing IDs in the side bar and we may tweak it and add it as validator for this repo.
import os 

def extract_id_from_file(file_path):
    """Extract the ID from a file where it's prefixed by 'id: ' on a separate line."""
    with open(file_path, 'r', encoding='utf-8') as file:
        for line in file:
            line = line.strip()
            if line.startswith('id: '):
                return line[4:].strip()
    return None


# Example usage
if __name__ == "__main__":
    docs_path = r"E:\Ynput\ayon-documentation\website\docs"
    allowed_extensions = {'.md', '.mdx'}  # Define allowed extensions for files in docs_path

    sidebar_path = r"E:\Ynput\ayon-documentation\website\sidebars.js"

    files_with_no_id = []
    missing_ids_in_sidebar = []

    # Get sidebar contents
    sidebar_contents = None
    with open(sidebar_path, 'r', encoding='utf-8') as f:
        sidebar_contents = f.read()

    # Find missing files in sidebar
    for filename in os.listdir(docs_path):
        file_path = os.path.join(docs_path, filename)
        if os.path.isfile(file_path) and any(filename.endswith(ext) for ext in allowed_extensions):
            extracted_id = extract_id_from_file(file_path)
            if extracted_id:
                if extracted_id not in sidebar_contents:
                    missing_ids_in_sidebar.append(extracted_id)
            else:
                files_with_no_id.append(file_path)

    if missing_ids_in_sidebar:
        print("Missing IDs in the sidebar:")
        for id in missing_ids_in_sidebar:
            print(f"- {id}")

    if files_with_no_id:
        print("Files with no ID:")
        for f in files_with_no_id:
            print(f"- {f}")

Testing notes:

  1. everything should be as before.
  2. now you can access zbrush docs in side
    image

@MustafaJafar MustafaJafar added the type: bug Something isn't working label Feb 7, 2025
@MustafaJafar MustafaJafar self-assigned this Feb 7, 2025
@MustafaJafar MustafaJafar requested a review from mkolar February 7, 2025 12:36
@MustafaJafar
Copy link
Contributor Author

MustafaJafar commented Feb 7, 2025

One question: where should this page added in the sidebar ?

https://ayon.ynput.io/docs/admin_webserver_for_webpublisher/

admin->integrations -> web publisher
But also this page is obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing pages in the sidebar
1 participant