Skip to content

Commit aecb21d

Browse files
authored
Merge pull request #11928 from lucas-amberg/fix_whitepaper
Fix url on whitepaper page to properly access whitepaper pdf [fixes #11918]
2 parents 6afb437 + 1febe24 commit aecb21d

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/components/Link.tsx

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const BaseLink = forwardRef(function Link(
8686
href,
8787
}
8888

89-
if (isInternalPdf || isExternal) {
89+
if (isExternal) {
9090
return (
9191
<ChakraLink
9292
isExternal
@@ -95,9 +95,7 @@ export const BaseLink = forwardRef(function Link(
9595
customEventOptions ?? {
9696
eventCategory: `Link`,
9797
eventAction: `Clicked`,
98-
eventName: `Clicked on ${
99-
isInternalPdf ? "internal PDF" : "external link"
100-
}`,
98+
eventName: "Clicked on external link",
10199
eventValue: href,
102100
}
103101
)
@@ -120,6 +118,32 @@ export const BaseLink = forwardRef(function Link(
120118
)
121119
}
122120

121+
if (isInternalPdf) {
122+
return (
123+
<ChakraLink
124+
isExternal
125+
// disable locale prefixing for internal PDFs
126+
// TODO: add i18n support using a rehype plugin (similar as we do for
127+
// images)
128+
locale={false}
129+
onClick={() =>
130+
trackCustomEvent(
131+
customEventOptions ?? {
132+
eventCategory: `Link`,
133+
eventAction: `Clicked`,
134+
eventName: "Clicked on internal PDF",
135+
eventValue: href,
136+
}
137+
)
138+
}
139+
{...commonProps}
140+
as={NextLink}
141+
>
142+
{children}
143+
</ChakraLink>
144+
)
145+
}
146+
123147
if (isHash) {
124148
return (
125149
<ChakraLink

0 commit comments

Comments
 (0)