diff options
Diffstat (limited to 'src/content/dependencies')
-rw-r--r-- | src/content/dependencies/linkExternal.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/content/dependencies/linkExternal.js b/src/content/dependencies/linkExternal.js index afdfe6ef..9469a9e9 100644 --- a/src/content/dependencies/linkExternal.js +++ b/src/content/dependencies/linkExternal.js @@ -26,31 +26,30 @@ export default { }, generate(data, slots, {html, language}) { - let formattedText = + const linkAttributes = html.attributes(); + + let linkContent = language.formatExternalLink(data.url, { style: slots.style, context: slots.context, }); // Fall back to platform if nothing matched the desired style. - if (html.isBlank(formattedText) && slots.style !== 'platform') { - formattedText = + if (html.isBlank(linkContent) && slots.style !== 'platform') { + linkContent = language.formatExternalLink(data.url, { style: 'platform', context: slots.context, }); } - const link = - html.tag('a', formattedText); - - link.attributes.set('href', data.url); - link.attributes.set('class', 'nowrap'); + linkAttributes.set('href', data.url); + linkAttributes.set('class', 'nowrap'); if (slots.tab === 'separate') { - link.attributes.set('target', '_blank'); + linkAttributes.set('target', '_blank'); } - return link; + return html.tag('a', linkAttributes, linkContent); }, }; |