the plugin overwrites already existing `rel` and `target` attributes
Opened this issue · 1 comments
In some cases we have some template code like
<a rel="me noopener" href="https://mastodon.social/@myprofile">my mastodon profile</p>
where the me
string is used for link verification, see https://docs.joinmastodon.org/user/profile/#verification.
Currently, the plugin overwrites the attribute with rel="noopener"
regardless of its previous content.
IMHO the plugin should leave a
-tags which already have a specified rel
attribute untouched, because we can assume that the template author knew what they were doing.
Same should hold for target
attributes.
My current workaround : edit the config file .eleventy.js
and replace the default regex with /^(([a-z]+:)|(\/\/))/i
with one that uses a negative look ahead (using the the syntax (?!XYZ))
.
In particular for domain names that start with "mastodon": /^(([a-z]+:)(?!\/\/mastodon)|(\/\/))/i
.
Helpfull online tool for this: https://regex101.com/