Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 575 Bytes

File metadata and controls

26 lines (22 loc) · 575 Bytes

Meziantou.Framework.Slug

Generate a slug from a string.

var result = Slug.Create("This is a text");

You can customize the slug generation:

var options = new SlugOptions()
{
    MaximumLength = 20,
    Separator = "-",
    CanEndWithSeparator = false,
    CasingTransformation = CasingTransformation.ToLowerCase,
    AllowedRanges = new List<UnicodeRange>
    {
        UnicodeRange.Create('a', 'z'),
        UnicodeRange.Create('A', 'Z'),
        UnicodeRange.Create('0', '9'),
    },
};
Slug.Create("This is a text", options); // this-is-a-text