Skip to content

Commit

Permalink
fix: use relURL only for link starts with slash (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
imfing authored Sep 13, 2023
1 parent 76ac694 commit a184cfd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions layouts/shortcodes/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
{{- end -}}

{{- $external := strings.HasPrefix $link "http" -}}

{{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}}

<a
class="hextra-card group flex flex-col justify-start overflow-hidden rounded-lg border border-gray-200 text-current no-underline dark:shadow-none hover:shadow-gray-100 dark:hover:shadow-none shadow-gray-100 active:shadow-sm active:shadow-gray-200 transition-all duration-200 {{ $linkClass }}"
href="{{ $link | relURL }}"
href="{{ $href }}"
{{- if $external }}
target="_blank" rel="noreferrer"
{{- end -}}
Expand Down

0 comments on commit a184cfd

Please sign in to comment.