Simple plugin to ensure links to external sites open in a new tab and contain
the necessary rel attributes to prevent security issues.
Optionally can also add an icon at the end of the link to visually indicate it is an external link.
To load this plugin, add the following to the extras block in your
config.php or
theme settings.php:
'extras' => [
// ...
'external-links' => [],
// ...
],
This allows you to mark domains that should not be treated as external links.
<script>
CMS.loadExtra('external-links', {
'local': ['localhost', '127.0.0.1', 'example.com']
});
</script>
Can be set to true to add an icon at the end of the link to visually indicate it is an external link.
<script>
CMS.loadExtra('external-links', {
'icons': true
});
</script>
N/A
[Example Site](https://example.com)
Will be rendered as:
<a href="https://example.com" target="_blank" rel="external noopener" class="external">Example Site</a>