Automatically add attributes for external links with Jekyll

Some time ago, I wrote that one should add rel="noopener noreferrer" to external links. And as it so happens, I added this attribute manually for all external links on this blog created with Jekyll. All in all, quite tedious.

Today I was wondering, if there is a possibility to automatically add those attributes during the build process. Shouldn’t be too difficult to implement, but it still would be neat to have a plugin readily available for such a functionality.

And sure enough, I found d-ogarkov/jekyll-extlinks which is easy enough to install and automatically adds the desired attributes to external links. The last update to the GitHub Repository may already be quite old, but the plugin works as expected. If you are looking for an alternative with more recent contributions, you could also take a look at keithmifsud/jekyll-target-blank. It seems to be a bit more sophisticated, but also very easy to integrate.