def METHOD_NAME(file: Path) -> t.Dict:
    """Extract metadata from file path according to naming convention."""
    order, stem = parse_filename(file.stem)
    title = stem.replace('_', ' ').replace('-', ' ').replace(' and ', ' & ')
    gh_path = str(file).replace(f"{INPUT_DIR.parent}/", '')
    if file.parent == INPUT_DIR:  # top level
        output = OUTPUT_DIR / file.name
        section = None
        slug = custom_slugify(order, stem, False)
        permalink = f"{MAIN_PERMALINK}{custom_slugify(order, stem)}/"
    else:
        output = OUTPUT_DIR / str(file).replace(f"{INPUT_DIR}/", '')
        section = file.parent.name
        s_order, s_stem = parse_filename(section)
        slug = custom_slugify(s_order, s_stem, False) + '--' + custom_slugify(order, stem, False)
        permalink = f"{MAIN_PERMALINK}{custom_slugify(s_order, s_stem)}/{custom_slugify(order, stem)}/"
    path = str(output).replace(f"{OUTPUT_DIR.parent}/", '')
    return {
        "stem": stem,
        "order": order,
        "slug": slug,
        "permalink": permalink,
        "title": title,
        "gh_path": gh_path,
        "path": path,
        "section": section,
        "output": output,
        "input": file,
    }