Install this theme component
Uses the default SVG (the same icon as Featured Links in core) like this link
Plays nicely with both light and dark themes, i.e…
This simply adds the icon. For a full featured solution try External Link Shield – Exit Confirmation & Trust Gating
TO DO: Settings for…
4개의 좋아요
Im seeing this in dark mode:
That is probably not the intended look?
Moin
12월 27, 2025, 10:24오전
3
The component works fine with different palettes
But a screenshot won’t adjust its color to the color palette. What would you suggest to present the feature in a forum where the component isn’t installed? A larger screenshot that includes the link?
I was about to suggest using the Discourse icon component, but I am unable to change the color of the icon:
example.com
[example.com]() [wrap=icon id=up-right-from-square][/wrap]
chapoi
12월 27, 2025, 10:27오전
4
Yes, I think so? That would be a better representation of what to expect.
I changed the image in the description/example it to a transparent .webp with a gray fill.
1개의 좋아요
chapoi
12월 27, 2025, 11:09오전
6
Awesome, looks way better!
1개의 좋아요
Hi, does not work for me, the icon appears on all links, even internal.
Another thing, for titles having a direct external link like YouTube video, the icon appears twice:
4개의 좋아요
Same here. The icon also appears on internal links.
If I understood the code correctly, it looks for “http*” in the URL to determine external links. Unfortunately the link tool in the editor automatically uses fully qualified (absolute) URLs starting with “https:///..”.
I assume that this causes the external icons on “internal” links.
Could the code be expanded to check for “https:///..” classifying these as internal?
1개의 좋아요
Lilly
(Lillian )
2월 3, 2026, 4:16오후
9
I made a PR to fix these issues.
https://github.com/denvergeeks/discourse-external-links-icon/pull/1/changes
this will hide the link icon for internal links, relative or absolute, as well as hide them in title links.
5개의 좋아요
Thank you @Lilly , I’ve merged this.
3개의 좋아요
Canapin
(Coin-coin le Canapin)
2월 3, 2026, 10:47오후
11
I did a similar thing with pure CSS a long time ago when Discourse used font awesome in font-family.
It’s not possible anymore, but a similar effect can be achieved with this:
.cooked {
a[href^="http"]:not([href*="www.yourdomain.com"]) {
display: inline-flex;
align-items: center;
&::after {
content: "";
width: 0.8em;
height: 0.8em;
margin-left: 0.2em;
margin-bottom: 0.4em;
background-color: currentColor;
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 640'%3E%3Cpath d='M384 64C366.3 64 352 78.3 352 96C352 113.7 366.3 128 384 128L466.7 128L265.3 329.4C252.8 341.9 252.8 362.2 265.3 374.7C277.8 387.2 298.1 387.2 310.6 374.7L512 173.3L512 256C512 273.7 526.3 288 544 288C561.7 288 576 273.7 576 256L576 96C576 78.3 561.7 64 544 64L384 64zM144 160C99.8 160 64 195.8 64 240L64 496C64 540.2 99.8 576 144 576L400 576C444.2 576 480 540.2 480 496L480 416C480 398.3 465.7 384 448 384C430.3 384 416 398.3 416 416L416 496C416 504.8 408.8 512 400 512L144 512C135.2 512 128 504.8 128 496L128 240C128 231.2 135.2 224 144 224L224 224C241.7 224 256 209.7 256 192C256 174.3 241.7 160 224 160L144 160z'/%3E%3C/svg%3E");
mask-size: contain;
}
}
}
SVG’s hardcoded, though.
Hi, me again, sorry
The external icons appear on the Custom Header Links (icons) TC, they shoul’nt. Thanks.
Don
2월 4, 2026, 6:47오전
13
Hello
Here is an example of how I use this in my theme component .
In my case, I use settings for this because the component changes icons dynamically via CSS, allowing me to target those settings directly. (Adding class to links doesn’t always work very well in some cases.)
However, for your component, you can simply exclude the current hostname dynamically something like this, I think:
import { apiInitializer } from "discourse/lib/api";
export default apiInitializer((api) => {
api.decorateCookedElement(
(element) => {
const currentHost = window.location.hostname;
const selector = `a[href*='//']:not([href^='/']):not([href*='${currentHost}'])`;
const links = element.querySelectorAll(selector);
links.forEach((link) => {
console.log("External link:", link.href);
});
},
{ id: "external-link", onlyStream: true }
);
});
I appreciate the feedback. This should be fixed now!
2개의 좋아요
Orioni
(John)
8월 28, 2026, 1:48오후
15
어떤 이유에서인지 링크 위에 마우스를 올리면 외부 아이콘이 사라집니다. 인스펙터로 테스트해 보니 ::after가 사라지는 것을 확인했습니다.
Canapin
(Coin-coin le Canapin)
8월 28, 2026, 3:59오후
16
아마도 다른 CSS 코드에 의해 덮어쓰기(overwrite)된 것 같습니다. 제 테스트 인스턴스에서는 호버 시 외부 아이콘이 사라지지 않습니다.
1개의 좋아요