Skip to content

Commit

Permalink
🔀 Merge pull request #813 from tomy0000000/dev
Browse files Browse the repository at this point in the history
🛠 fix: Space in rendered link
  • Loading branch information
jpanther authored Mar 9, 2024
2 parents 21b554c + 0a6267c commit e2fa33a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions layouts/_default/_markup/render-link.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{- $link := .Destination -}}
{{- $isRemote := strings.HasPrefix $link "http" -}}
{{- if not $isRemote }}
{{ $url := urls.Parse .Destination }}
{{- $url := urls.Parse .Destination -}}
{{- if $url.Path }}
{{ $fragment := "" }}
{{- $fragment := "" }}
{{- with $url.Fragment }}{{ $fragment = printf "#%s" . }}{{ end -}}
{{- with .Page.GetPage $url.Path }}
{{ $link = printf "%s%s" .RelPermalink $fragment }}
Expand All @@ -14,5 +14,4 @@
{{ end -}}
{{ end -}}
{{ end -}}
<!-- prettier-ignore -->
<a href="{{ $link | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank" rel="noreferrer"{{ end }}>{{- .Text | safeHTML -}}</a>
<!-- prettier-ignore --><a href="{{ $link | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $isRemote }} target="_blank" rel="noreferrer"{{ end }}>{{- .Text | safeHTML -}}</a>

0 comments on commit e2fa33a

Please sign in to comment.