Skip to content

Latest commit

 

History

History

external-links

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

@sardine/eleventy-plugin-external-links

An 11ty plugin to protect you external links.

Features

Adds target="_blank" rel="noreferrer" to all external links to make them safer.

Original Anchor tags:

<html>
  <body>
    <a href="https://www.external.com">Hello to the outside!</a>
    <a href="/internal/link/">Hello to me!</a>
  </body>
</html>

Generated Anchor tags:

<html>
  <body>
    <a href="https://www.external.com" target="_blank" rel="noreferrer">Hello to the outside!</a>
    <a href="/internal/link/">Hello to me!</a>
  </body>
</html>

Requirements

Installation

npm install --save-dev @sardine/eleventy-plugin-external-links

How to use it

const safeLinks = require('@sardine/eleventy-plugin-external-links');
module.exports = function (eleventyConfig) {
  eleventyConfig.addPlugin(safeLinks);
};

License

MIT