Skip to main content

is_route_active

Check whether the given path matches the current location.

Useful for highlighting active navigation links or tabs.

Parameters:

  • path (str) - Path to check against the current location.
  • exact (bool, default: False) - If True, requires an exact match. If False (default), a prefix match is used (e.g. "/products" matches "/products/42").

Returns:

  • bool - True if the path matches the current location.