A PicoCMS plugin to mark external links and open them in a new tab
ohnonot 4090239c38 git-check-20240105-0948 | před 10 měsíci | |
---|---|---|
LICENSE | před 1 rokem | |
PicoTargetBlank.php | před 1 rokem | |
README.md | před 10 měsíci |
Inspired by this.
Please consult PicoCMS' generic plugin installation instructions.
The plugin is enabled by default.
You can disable it in config.yml
:
PicoTargetBlank:
enabled: false
You can also set the rel= attribute, or disable it with an empty string:
rel: 'noopener noreferrer nofollow
or
rel: ''
etc.
defaults to 'noopener noreferrer'
if unspecified. See here for an explanation.
It picks the rendered page apart and compares each anchor's host to the server's value of $_SERVER['HTTP_HOST']
- if they differ, it adds target="_blank"
, the configurable rel
attribute, a mouseover title and the external
CSS class to the link.
CSS is not included with this plugin. If you want to add a small arrow to the link text, add this to your stylesheets:
a.external::after {
line-height: 100%;
vertical-align: super;
font-size: 60%;
content: "↗"
}
There's no Unicode symbol for the commonly seen box with the outgoing arrow; you can use the above or do some SVG magic.
If you don't want the arrow on some external links, add the "noarrow" class. CSS:
a.external.noarrow::after { content: '' }