def file_sort_key(f: File, /):
    """
    Replicates the sort order how `get_files` produces it - index first, directories last.

    To sort a list of `File`, pass as the `key` argument to `sort`.
    """
    parts = PurePosixPath(f.src_uri).parts
    if not parts:
        return ()
    return (parts[:-1], f.name != "index", parts[-1])

    Replicates the sort order how `get_files` produces it - index first, directories last.

    To sort a list of `File`, pass as the `key` argument to `sort`.
    
mkdocs/structure/files.py