Liking cljdoc? Tell your friends :D


Sluj is a very small library for converting strings of UTF-16 text to slugs. A slug is a piece of text that is URL safe. Sluj can translate a wide variety of characters, including but not limited to cyrillic, and japanese characters.

This library adheres to the following:

Shout out to Trott/slug for inspiring me to make this over a rainy weekend.


Clojars Project

This project is available on Clojars, and you can add it to your lein project via:

[com.github.rawleyfowler/sluj "1.0.1"]


Currently the most starred Slug clojure project is abandoned by the maintainer, plus it has dependencies. I thought that I could make it better, so I set out on this project.


Particularly looking for contributions to the locale settings of the project, as there is no way I could create a locale for every alphabet myself. Also, the library needs a little work in the multi-byte characters department.


;; Simple examples
(sluj "Hey it's me!") ;; => hey-its-me
(sluj "25 ways to pet a cat") ;; => 25-ways-to-pet-a-cat

;; UTF-16 examples
(sluj "I ♥ Unicode!") ;; => i-unicode
(sluj "I ♥ Unicode!" :♥ "love") ;; => i-love-unicode

(sluj "Turn this ship 200°!") ;; => turn-this-ship-200
(sluj "Turn this ship 200 °!" :° "degrees") ;; => turn-this-ship-200-degrees

;; Non english characters
;; These were made with google translate, sorry in advanced.
;; Default locale is Russian for Cyrillics
(sluj "маленький подъезд") ;; => malenkij-poduezd

;; Change the locale if you wish
(sluj "маленький подъезд" :locale "bg") ;; => malenykiy-podaezd

;; Change sparator
(sluj "hi mom" :separator "%") ;; => hi%mom

;; Pass the charmap as a argument
(sluj "I have weird characters ☢ ♥" :charmap {:♥ "heart" :☢ :radiate}) ;; => i-have-weird-characters-radiate-heart
;; Alternatively
(sluj "I have weird characters ♥ ☢" :♥ "heart" :☢ "radiate") ;; => i-have-weird-characters-radiate-heart

;; Change the casing
(sluj "make me upper" :casing "upper") ;; => MAKE-ME-UPPER


This project is licensed via the MIT license. Please read through the LICENSE file at the root of the project for more information.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close