Skip to content

jd-carroll/gatsby-remark-external-links

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gatsby-remark-external-links

Adds the target and rel attributes to external links in markdown.

This is a gatsby port of the remark-external-links remark plugin.

Usage

  1. Install plugin to your site:
yarn add gatsby-remark-external-links
  1. Add following to your gatsby-config.js:
    plugins: [      
      {
        resolve: `gatsby-transformer-remark`,
        options: {
          plugins: [
          {
            resolve: "gatsby-remark-external-links",
            options: {
              target: "_self",
              rel: "nofollow"
            }
          }
          ]
        }
      },
  1. Restart gastby.

API

options

target

Type: string Default: _blank

Specifies where to display the linked URL. The value should be on of : _self, _blank, _parent, _top

You can specify null to not add the target attribute to your links

rel

Type: string Default: nofollow noopener noreferrer

Specifies the relationship of the target object to the link object. The value is a space-separated list of link types.

You can specify null to not add the rel attribute to your links

When using target, consider adding rel="noopener noreferrer" to avoid exploitation of the window.opener API.

License

MIT

About

Adds the target and rel attributes to external links in markdown.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%