No release in over a year
This plugin adds `rel` and `target` attributes to all external links in your Jekyll site.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.0.0
>= 4.0.0
>= 1.0.0
>= 10.0.0
 Project Readme

Jekyll Link Attributes

This plugin adds rel and target attributes to all external links in your Jekyll site. The default configuration opens external links in a new tab and conserves domain authority for your site.

Setup

  1. Add the gem to your Gemfile:
    gem 'jekyll-link-attributes'
  2. Run bundle install to install the gem
  3. Add the following to your _config.yml:
    plugins:
      - jekyll-link-attributes

Usage

Configuration

You can override the default configuration by adding the following section to your Jekyll site's _config.yml:

external_links:
  enabled: true
  rel: external nofollow noopener
  target: _blank
  exclude:
    - https://example.com
    - https://another.example.com/test.html
    - https://regex.example.com/.+

Default Configuration

Key Default Value Description
external_links.enabled true Enable attribute modifications for external links.
external_links.rel external nofollow noopener The rel attribute to add to external links.
external_links.target _blank The target attribute to add to external links.
external_links.exclude [] A list of URLs to exclude from processing.

Skipping individual links

The rel or target attributes will not be modified for links that already have those existing attributes. This allows you to skip individual links without having to modify the plugin's configuration.

<a href"https://example.com" rel="nofollow">Example</a> <!-- `rel` will not be modified, but the configured `target` will be added. -->
<a href"https://example.com" target="_self">Example</a> <!-- `target` will not be modified, but the configured `rel` will be added. -->
<a href"https://example.com" rel="nofollow" target="_self">Example</a> <!-- Neither `rel` nor `target` will be modified. -->

Contributing

Pull requests are welcome! If you wish to change existing behavior, please open an issue to discuss the change before investing time in a PR. RSpec tests are encouraged for any new features.

Supported by Twin Sun

This project is maintained by Twin Sun, a custom mobile and web app development agency in Nashville, TN.