Module

content.utils.slugify

Slug generation utilities.

Provides consistent slug generation from paths and titles across all content sources (local, GitHub, Notion, REST).

Functions

path_to_slug 2 str
Convert relative path to URL-friendly slug. **Handles:** - Extension removal (…
def path_to_slug(rel_path: Path | str, *, handle_index: bool = True) -> str

Convert relative path to URL-friendly slug.

Handles:

  • Extension removal (.md, .markdown, etc.)
  • Path separator normalization (backslash → forward slash)
  • Index file handling (path/index → path)
Parameters
Name Type Description
rel_path Path | str

Path relative to content directory

handle_index bool

If True, strip trailing /index from slugs

Default:True
Returns
str
title_to_slug 1 str
Convert title string to URL-friendly slug. **Handles:** - Lowercasing - Removi…
def title_to_slug(title: str) -> str

Convert title string to URL-friendly slug.

Handles:

  • Lowercasing
  • Removing special characters
  • Replacing spaces with hyphens
  • Collapsing multiple hyphens
Parameters
Name Type Description
title str

Page or document title

Returns
str