slugify_batch()
slugany.slugify_batch ¶
slugify_batch(texts: Iterable[str], *, separator: str | None = None, lowercase: bool | None = None, max_length: int = 0, word_boundary: bool = False, stopwords: Iterable[str] | None = None, allow_unicode: bool = False, replacements: Mapping[str, str] | Iterable[tuple[str, str]] | None = None, style: str | None = None, lang: str = 'auto', fallback: str = '', emoji_mode: str = 'strip', css_safe: bool = False, html_entities: bool = True, smart_punctuation: bool = True) -> list[str]
Slugify multiple texts in a single call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
texts
|
Iterable[str]
|
Iterable of strings to slugify. |
required |
separator
|
str | None
|
Separator between words. Defaults to |
None
|
lowercase
|
bool | None
|
Whether to lowercase the output. Defaults to |
None
|
max_length
|
int
|
Maximum slug length. |
0
|
word_boundary
|
bool
|
Truncate at the last word boundary within |
False
|
stopwords
|
Iterable[str] | None
|
Iterable of words to remove from the output. |
None
|
allow_unicode
|
bool
|
Preserve Unicode characters instead of transliterating. |
False
|
replacements
|
Mapping[str, str] | Iterable[tuple[str, str]] | None
|
Mapping or iterable of |
None
|
style
|
str | None
|
Case style preset ( |
None
|
lang
|
str
|
Language for transliteration
( |
'auto'
|
fallback
|
str
|
String to return when the slug would be empty. This value is returned as-is — it should be a valid slug. |
''
|
emoji_mode
|
str
|
How to handle emojis ( |
'strip'
|
css_safe
|
bool
|
Prefix with |
False
|
html_entities
|
bool
|
Decode HTML entities like |
True
|
smart_punctuation
|
bool
|
Normalize smart quotes, dashes, and zero-width characters. |
True
|
Returns:
| Type | Description |
|---|---|
list[str]
|
A list of slugified strings, one per input text. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If any text is not a string. |
ValueError
|
If an invalid |
Examples: