Bulk Slug URL Generator - jQuery multiline-slug

File Size: 4.23 KB
Views Total: 2333
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Bulk Slug URL Generator - jQuery multiline-slug

multiline-slug is a bulk slug generator written in jQuery that converts multi-line strings, words or text into SEO-friendly and human-readable URL slugs, permalinks, etc.

Supports multiple languages using accent and special characters.

Based on the url_slug.js created by Sean Murphy.

How to use it:

1. Create a textarea to accept the multi-line strings, words or text.

<textarea id="txt_src">
multi-line strings, words or text here
</textarea>

2. Create another textarea that will ouput the generated URL slugs.

<textarea id="txt_trg">
</textarea>

3. Include both jQuery library and the url_slug.js on the webpage.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous">
</script>
<script src="js/url_slug.js"></script>

4. The JavaScript to enable the Bulk Slug URL Generator.

$(function(){

  var lines = $('#txt_trg').val("");
  var lines = $('#txt_src').val();
  var lines_array = lines.split("\n");
  for(i=0;i<lines_array.length;i++){
    $('#txt_trg').val( $('#txt_trg').val() + url_slug(lines_array[i]) + "\n")//  getSlug(lines_array[i]);
  }

});

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