Need help with slugify?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

slugify
224 Stars 33 Forks Apache License 2.0 192 Commits 5 Opened issues

Description

SEO-friendly URLs with Slugify

Services available

!
?

Need anything else?

Contributors list

Slugify Build Status

SEO-friendly URLs with Slugify

Notice

If you want to use it directly in your JSP, take a look into jstl

Usage

If you want to use Slugify in your Java code you only need the library itself. Here's the dependency information for Maven:

    com.github.slugify
    slugify
    2.4

Now you're able to use it:

Slugify slg = new Slugify();
String result = slg.slugify("Hello, world!");
// result: hello-world

You can set custom replacements for Slugify:

Slugify slg = slg.withCustomReplacement("hello", "world").withCustomReplacement("foo", "bar");
// or multiple at once
slg = slg.withCustomReplacements(new HashMap() {{
    put("hello", "world");
    put("foo", "bar");
}});

String result = slg.slugify("hello foo"); // result: world-bar

Or if you want case sensitivity:

Slugify slg = new Slugify().withLowerCase(false);
String result = slg.slugify("Hello, World!");
// result: Hello-World

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.