Skip to content

Commit

Permalink
feat: optional special treatment for external links
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Guillot committed Oct 7, 2024
1 parent a2eb47b commit 96233b9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
40 changes: 40 additions & 0 deletions assets/css/common/post-single.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,46 @@
box-shadow: 0 -1px 0 var(--primary) inset;
}

.post-content a.external-link {
display: inline-flex;
align-items: center;
gap: 5px;
}

.post-content a.external-link::after {
content: "";
display: inline-block;
clip-path: polygon(
60% 5%,
60% 0%,
100% 0%,
100% 5%,
100% 40%,
94.98% 40%,
94.98% 5%,
94.98% 9.59%,
42.41% 59.2%,
38.1% 54.64%,
90.7% 5%,
60% 5%,
50% 8%,
13% 8%,
8% 8%,
8% 92%,
92% 92%,
92% 50%,
87% 50%,
87% 87%,
13% 87%,
13% 13%,
50% 13%,
50% 8%
);
background-color: var(--primary);
width: 18px;
height: 18px;
}

.post-content del {
text-decoration: line-through;
}
Expand Down
4 changes: 4 additions & 0 deletions layouts/_default/_markup/render-link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}
{{ if and site.Params.ExternalLinksIcon (strings.HasPrefix .Destination "http") }} class="external-link"{{ end }}
{{ if and site.Params.ExternalLinksNewTab (strings.HasPrefix .Destination "http") }} target="_blank"{{ end }}
>{{ .Text }}</a>

0 comments on commit 96233b9

Please sign in to comment.