Skip to content

stonio/slugify

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

<dependency>
	<groupId>com.github.slugify</groupId>
	<artifactId>slugify</artifactId>
	<version>2.1.5</version>
</dependency>

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 = new Slugify();
slg.setCustomReplacements(new HashMap<String, String>() {{
    put("foo", "bar");
}});
String result = slg.slugify("Hello foo");
// result: hello-bar

Or if you want case sensitivity:

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

About

SEO-friendly URLs with Slugify

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%