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 functionality from HTML:
<script>
CMS.loadExtra('external-links');
</script>
or from within config.js
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>