Skip to content

A simple gem to add accessibility to external links in blog posts

License

Notifications You must be signed in to change notification settings

fastruby/jekyll-external-link-accessibility

Repository files navigation

Jekyll External Link Accessibility

This plugin adds rel, title, new tab icon and target to all external links in your blog post.

Setup

  1. Add the gem to your Gemfile:
    gem 'jekyll-external-link-accessibility', github: 'fastruby/jekyll-external-link-accessibility'
  2. Run bundle install to install the gem
  3. Add the following to your _config.yml:
    plugins:
      - jekyll-external-link-accessibility

Usage

The plugin automatically edits all links on all posts. You can however skip the check on some links, by adding the data-no-external attribute and setting it to true, e.g <a href="...." data-no-external="true">...</a> to the link.

Configuration

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

external_links:
  rel: external nofollow noopener noreferrer
  target: _blank
  title: Opens a new window

Styling

Next to each external link is an icon for external links with a icon-external-link class name. You need to have the styles in your project. For example, we use icomoon for icons:

.icon-external-link:before {
  content: "\ea7e";
}

Default Configuration

Key Default Value Description
external_links.rel external nofollow noopener noreferrer The rel attribute to add to external links.
external_links.target _blank The target attribute to add to external links.
external_links.title Opens a new window The title attribute to add title to links.

About

A simple gem to add accessibility to external links in blog posts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages