diff options
-rw-r--r-- | src/content/dependencies/linkTemplate.js | 24 | ||||
-rw-r--r-- | src/static/css/site.css | 8 |
2 files changed, 23 insertions, 9 deletions
diff --git a/src/content/dependencies/linkTemplate.js b/src/content/dependencies/linkTemplate.js index 63cc82e8..4f853dc4 100644 --- a/src/content/dependencies/linkTemplate.js +++ b/src/content/dependencies/linkTemplate.js @@ -26,6 +26,11 @@ export default { type: 'html', mutable: false, }, + + suffixNormalContent: { + type: 'html', + mutable: false, + }, }, generate(slots, { @@ -61,13 +66,22 @@ export default { attributes.set('title', slots.tooltip); } - const content = + const mainContent = (html.isBlank(slots.content) ? language.$('misc.missingLinkContent') - : striptags(html.resolve(slots.content, {normalize: 'string'}), { - disallowedTags: new Set(['a']), - })); + : striptags( + html.resolve(slots.content, {normalize: 'string'}), + {disallowedTags: new Set(['a'])})); + + const allContent = + (html.isBlank(slots.suffixNormalContent) + ? mainContent + : html.tags([ + mainContent, + html.tag('span', {class: 'normal-content'}, + slots.suffixNormalContent), + ], {[html.joinChildren]: ''})); - return html.tag('a', attributes, content); + return html.tag('a', attributes, allContent); }, } diff --git a/src/static/css/site.css b/src/static/css/site.css index 542a2f7d..5515030f 100644 --- a/src/static/css/site.css +++ b/src/static/css/site.css @@ -887,6 +887,10 @@ a:not([href]):hover { text-decoration: none; } +a .normal-content { + color: white; +} + .external-link:not(.from-content) { white-space: nowrap; } @@ -900,10 +904,6 @@ a:not([href]):hover { color: white; } -.external-link .normal-content { - color: white; -} - .image-media-link::after { content: ''; display: inline-block; |