Auto Link Keywords In The Document - jQuery linkit.js

Auto Link Keywords In The Document - jQuery linkit.js

linkit.js is a jQuery SEO plugin for internal links that automatically link keywords and phrases with custom styles and behaviors in the document.

1. Insert the minified version of the jQuery linkit.js plugin after jQuery library (slim build is recommended).

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" 
        integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" 
        crossorigin="anonymous">
</script>
<script src="dist/linkit.min.js"></script>

2. Call the function on the target container and specify the desired word/phrase and URL you want to replace.

<p>linkit.js is a jQuery SEO plugin for internal links that automatically link keywords and phrases with custom styles and behaviors in the document.</p>
$('p').linkIt({
  link: {
    word: 'jQuery',
    url: 'https://www.jqueryscript.net/'
  }
});

3. Set if is case sensitive.

$('p').linkIt({
  link: {
    word: 'jQuery',
    url: 'https://www.jqueryscript.net/'
  },
  caseSensitive: true
});

4. Add custom color or CSS class to the links.

$('p').linkIt({
  link: {
    word: 'jQuery',
    url: 'https://www.jqueryscript.net/'
  },
  linkColor: '#222',
  linkClass: 'custom-class'
});

5. Decide whether to open the link in a new tab/window.

$('p').linkIt({
  link: {
    word: 'jQuery',
    url: 'https://www.jqueryscript.net/'
  },
  newWindow: true
});

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

  • Publication date: 12.01.2018
  • Source