Table of Contents

Class SlugGenerator

Namespace
Builvero.Application.Utilities
Assembly
Builvero.Application.dll

Utility class for generating URL-friendly slugs from text.

public static class SlugGenerator
Inheritance
SlugGenerator
Inherited Members

Methods

GenerateSlug(string)

Generates a URL-friendly slug from the input text.

public static string GenerateSlug(string text)

Parameters

text string

The text to convert to a slug.

Returns

string

A URL-friendly slug (lowercase, hyphens instead of spaces, special characters removed).

GenerateUniqueSlugAsync(string, Func<string, Task<bool>>)

Generates a unique slug by appending a number if the base slug already exists.

public static Task<string> GenerateUniqueSlugAsync(string baseSlug, Func<string, Task<bool>> slugExists)

Parameters

baseSlug string

The base slug to make unique.

slugExists Func<string, Task<bool>>

Function to check if a slug exists.

Returns

Task<string>

A unique slug.