Multilingual URL Slug Generator - jQuery slugIt!

File Size: 6.61 KB
Views Total: 376
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Multilingual URL Slug Generator - jQuery slugIt!

slugIt! is a tiny yet feature-rich jQuery slug generator for generating readable and SEO-friendly URL slugs from any strings.

Features:

  • Replaces spaces and unwanted chars with custom separators.
  • Trims leading/trailing separators.
  • Eliminates repeated separatos.
  • Converts uppercase to lowercase.
  • Supports European utf8 chars: Latin, Greek, Turkish, Russian, Ukranian, Czech, Polish, and Latvian.
  • Supports currency symbols like €, $, £, etc.
  • Supports special characters like ©, (c), ∆, etc.
  • Allows you to create your own character mappings.

See Also:

How To Use It:

1. Download and import the jQuery slugIt plugin.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/jquery.slugit.js"></script>

2. Call the plugin on the target input field.

<input type="text" id="input" value="I love jQueryScript">
<input type="text" class="output" readonly />
$(function(){
  $('#input').slugIt({
    output: '.output', // default: '#slug'
  });
});

3. Override the default separator (-).

$(function(){
  $('#input').slugIt({
    separator: '_',
  });
});

4. Override the default trigger events.

$(function(){
  $('#input').slugIt({
    events: 'keypress keyup',
  });
});

5. Add your own character mappings.

$(function(){
  $('#input').slugIt({
    map: { 
      '*': 'star' 
    }
  });
});

6. Callback functions.

$(function(){
  $('#input').slugIt({
    before: function(text){
      // ...
    }
    after: function(slug){
      // ...
    }
  });
});

This awesome jQuery plugin is developed by diegok. For more Advanced Usages, please check the demo page or visit the official website.