Improve look of external link icons, add them to sidebar

This commit is contained in:
Joshua Goins 2023-03-28 17:45:17 -04:00
parent 7ab58cd056
commit e0b91caa3f
3 changed files with 9 additions and 2 deletions

View file

@ -390,3 +390,8 @@ pre {
margin: 10px;
border: 1px inset black;
}
.external-link {
vertical-align: sub;
margin-left: 2px;
}

View file

@ -1,4 +1,4 @@
{{ $icon := resources.Get "external-link.svg" }}
<a class="ext-link" href="{{ .Destination | safeURL }}" {{ if strings.HasPrefix .Destination "http" }}
target="_blank"{{ end }}>{{ .Text | safeHTML }}{{ if strings.HasPrefix .Destination "http" }}<img aria-hidden="true" alt="External link" width="16" height="16" src="{{ $icon.Permalink }}"/>{{- end -}}</a>
target="_blank"{{ end }}>{{ .Text | safeHTML }}{{ if strings.HasPrefix .Destination "http" }}<img class="external-link" aria-hidden="true" alt="External link" width="16" height="16" src="{{ $icon.Permalink }}"/>{{- end -}}</a>

View file

@ -1,7 +1,9 @@
<nav>
{{ $icon := resources.Get "external-link.svg" }}
{{ range .Site.Menus.main }}
<div class="site-menu">
<a href="{{ .URL }}">{{ .Name }}</a>
<a href="{{ .URL }}">{{ .Name }}{{ if strings.HasPrefix .URL "http" }}<img class="external-link" aria-hidden="true" alt="External link" width="16" height="16" src="{{ $icon.Permalink }}"/>{{- end -}}</a>
</div>
{{ end }}
</nav>