{{- $rel := "" -}} {{- $external := false -}} {{- $noreferrer := true -}} {{- if eq .Noreferrer false -}} {{- $noreferrer = false -}} {{- end -}} {{- $url := urls.Parse .Destination -}} {{- if $url.IsAbs | or .Newtab -}} {{- $rel = cond $noreferrer "external nofollow noopener noreferrer" "external nofollow" -}} {{- $external = true -}} {{- end -}} {{- $class := .Class | default "" -}} {{- if eq .Card true -}} {{- $class = trim (printf "%v %v" "card-link" $class) " " -}} {{- end -}} {{- if ne .Card true -}} {{- with .Icon -}} {{- partial "plugin/icon.html" . }} {{ end -}} {{- with .Content -}} {{- . | safeHTML -}} {{- end -}} {{- if (.ExternalIcon | default false) | and $external | and (eq (hasPrefix .Content ``) | or (strings.HasSuffix .Content `):`)) false) -}} {{- if .Download -}} {{- dict "Class" "fa-solid fa-cloud-download-alt fa-fw ms-1 text-secondary" | partial "plugin/icon.html" -}} {{- else -}} {{- dict "Class" "fa-solid fa-external-link-alt fa-fw fa-xs ms-1 text-secondary" | partial "plugin/icon.html" -}} {{- end -}} {{- else if .Download }} {{- dict "Class" "fa-solid fa-download fa-fw ms-1 text-secondary" | partial "plugin/icon.html" -}} {{- end -}} {{- else -}} {{- $cardIcon := .CardIcon -}} {{- if $url.Host | and (eq $cardIcon "") -}} {{- $favicon := partial "function/get-remote-image.html" (dict "Path" (add "https://www.google.com/s2/favicons?sz=64&domain=" $url.Host) "Pass" true) -}} {{- if $favicon -}} {{- $cardIcon = $favicon.RelPermalink -}} {{- end -}} {{- end -}} {{- $attrs := `class="cl-backdrop"` -}} {{- $attrs = printf ` style="--cl-bg-url: url(%v);"` (resources.Get "images/fixit.svg" | minify).RelPermalink | add $attrs -}} {{- with .Icon -}} {{- partial "plugin/icon.html" . }} {{ end -}} {{- with .Content -}} {{- . | safeHTML -}} {{- end -}} {{- .Destination | safeURL -}} {{- if .Download -}} {{- else -}} {{- with $cardIcon -}} {{- if (strings.HasPrefix . "fa") -}} {{- else -}} card icon {{- end -}} {{- else -}} {{- end -}} {{- end -}} {{- end -}} {{- /* EOF */ -}}