https://github.com/fastruby/jekyll-external-link-accessibility
A simple gem to add accessibility to external links in blog posts
https://github.com/fastruby/jekyll-external-link-accessibility
Last synced: 4 months ago
JSON representation
A simple gem to add accessibility to external links in blog posts
- Host: GitHub
- URL: https://github.com/fastruby/jekyll-external-link-accessibility
- Owner: fastruby
- License: mit
- Created: 2023-03-30T19:17:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-20T20:47:51.000Z (over 2 years ago)
- Last Synced: 2025-08-28T15:14:44.697Z (4 months ago)
- Language: Ruby
- Size: 14.6 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# 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`:
```ruby
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`:
```yaml
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 `...` to the link.
### Configuration
You can override the default configuration by adding the following section to your Jekyll site's `_config.yml`:
```yaml
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:
```css
.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. |