Closed rootwork closed 3 years ago
FYI @onweru it looks like this also exists in your other themes, but I haven't used them so I can't confirm testing. For your convenience:
https://github.com/onweru/hugo-swift-theme/blob/3a49e560089cd3692fd4fd4e84c71d55687b20d4/assets/js/index.js#L57 https://github.com/onweru/compose/blob/3f2ccb9b9acb30834cb7759d14b57f884ea03981/assets/js/index.js#L168 https://github.com/onweru/newsroom/blob/59ae2f193880e25ad2610cd55185ea82fef92a34/assets/js/index.js#L188
FYI @onweru it looks like this also exists in your other themes, but I haven't used them so I can't confirm testing. For your convenience:
https://github.com/onweru/hugo-swift-theme/blob/3a49e560089cd3692fd4fd4e84c71d55687b20d4/assets/js/index.js#L57 https://github.com/onweru/compose/blob/3f2ccb9b9acb30834cb7759d14b57f884ea03981/assets/js/index.js#L168 https://github.com/onweru/newsroom/blob/59ae2f193880e25ad2610cd55185ea82fef92a34/assets/js/index.js#L188
@rootwork, yes this is true. I will fix them when I can
Short description
makeExternalLinks()
has a small mistake that doesn't allow therel
attribute in an external link to be overridden.Specifically, I wanted to do this in the
follow.html
layout partial to enable indieweb RelMeAuth.If you look at the file changes, you'll probably understand it right away, without the need for the long description to follow...
Long description with screenshots
When including an external link in a layout file, you might want to override the default attributes set by the
makeExternalLinks()
function. For instance, infollow.html
, this is used to construct the links:By default, that will result in a link like this:
The
rel
andtarget
attributes come from themakeExternalLinks()
function.If you set these attributes in the layout file, it should override what
makeExternalLinks()
is doing. For instance, if you set the target with<a href="{{ $url }}" target="foo">
, you'll get<a href="..." target="foo">
.But because of the mistake in
makeExternalLinks()
, you can't do that withrel
; it will always be set tonoopener
.With the fix, the default output is the same:
But if you override
rel
in a layout file, e.g. with<a href="{{ $url }}" rel="me">
, you get the overridden value in the output as well:Checklist
Ensure you have checked off the following before submitting your PR.