From 6645e6e8e0e58c59d1660767181bb32efbf7930a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 8 Aug 2023 20:55:21 -0300 Subject: content: transformContent: don't override previously set link slots --- src/content/dependencies/transformContent.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/content/dependencies/transformContent.js b/src/content/dependencies/transformContent.js index eed00882..9a135eef 100644 --- a/src/content/dependencies/transformContent.js +++ b/src/content/dependencies/transformContent.js @@ -370,16 +370,18 @@ export default { const {link, label, hash, toIndex} = linkNode; - return { - type: 'link', - data: - (toIndex - ? link.slots({content: label, hash}) - : link.slots({ - content: label, hash, - preferShortName: slots.preferShortLinkNames, - })), - }; + // These are removed from the typical combined slots({})-style + // because we don't want to override slots that were already set + // by something that's wrapping the linkTemplate or linkThing + // template. + if (label) link.setSlot('content', label); + if (hash) link.setSlot('hash', hash); + + if (toIndex) { + link.setSlot('preferShortName', slots.preferShortLinkNames); + } + + return {type: 'link', data: link}; } case 'tag': { -- cgit 1.3.0-6-gf8a5