urlizetrunc
Convert URLs into clickable links, truncating URLs to the given character limit, and adding 'rel=nofollow' attribute to discourage spamming.
def urlizetrunc(
value: string,
limit: int,
autoescape: boolean = True
) - > string
Convert URLs into clickable links, truncating URLs to the given character limit, and adding 'rel=nofollow' attribute to discourage spamming.
Parameters
| Name | Type | Description |
|---|---|---|
| value | string | The input text containing URLs to be converted into clickable HTML links. |
| limit | int | The maximum character length for the displayed link text before it is truncated. |
| autoescape | boolean = True | Indicates whether the input text and resulting HTML should be automatically escaped to prevent XSS attacks. |
Returns
| Type | Description |
|---|---|
string | The processed string containing HTML anchor tags with truncated link text and nofollow attributes, marked as safe for Django templates. |