feat: mark external links with an icon and rel=external

This commit is contained in:
Bruno Carlin 2025-06-17 01:35:34 +02:00
parent 645a474cab
commit 3e98ac15b6
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 8E254EA0FFEB9B6D
2 changed files with 17 additions and 1 deletions

View file

@ -327,10 +327,18 @@ pre {
margin-bottom: calc(1.5 * var(--pico-spacing));
}
code, kdb, pre {
code, kbd, pre {
font-size: 0.8em;
}
a[rel="external"]::after {
content: url('data:image/svg+xml,%3Csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20viewBox=%270%200%2024%2024%27%20fill=%27currentColor%27%3E%3Cpath%20d=%27M10%206V8H5V19H16V14H18V20C18%2020.5523%2017.5523%2021%2017%2021H4C3.44772%2021%203%2020.5523%203%2020V7C3%206.44772%203.44772%206%204%206H10ZM21%203V11H19L18.9999%206.413L11.2071%2014.2071L9.79289%2012.7929L17.5849%205H13V3H21Z%27%3E%3C/path%3E%3C/svg%3E');
width: 0.7em;
display: inline-block;
margin-left: 0.2em;
vertical-align: middle;
}
/*
* Admonitions
*/

View file

@ -0,0 +1,8 @@
{{- $u := urls.Parse .Destination -}}
<a href="{{ .Destination | safeURL }}"
{{- with .Title }} title="{{ . }}"{{ end -}}
{{- if $u.IsAbs }} rel="external"{{ end -}}
>
{{- with .Text }}{{ . }}{{ end -}}
</a>
{{- /* chomp trailing newline */ -}}