{{- $context := . -}} {{- $link := .Get "link" -}} {{- $title := .Get "title" -}} {{- $icon := .Get "icon" -}} {{- $subtitle := .Get "subtitle" -}} {{- $image := .Get "image" -}} {{- $width := 0 -}} {{- $height := 0 -}} {{/* Image processing options */}} {{- $method := .Get "method" | default "Resize" | humanize -}} {{- $options := .Get "options" | default "800x webp q80" -}} {{- if and $image (not (urls.Parse $image).Scheme) -}} {{/* Process images in assets */}} {{- with resources.Get $image -}} {{- $processed := "" -}} {{- if eq $method "Resize" -}} {{- $processed = (.Resize $options) -}} {{- else if eq $method "Fit" -}} {{- $processed = (.Fit $options) -}} {{- else if eq $method "Fill" -}} {{- $processed = (.Fill $options) -}} {{- else if eq $method "Crop" -}} {{- $processed = (.Crop $options) -}} {{- else -}} {{- errorf "Invalid image processing command: Must be one of Crop, Fit, Fill or Resize." -}} {{- end -}} {{- $width = $processed.Width -}} {{- $height = $processed.Height -}} {{- $image = $processed.RelPermalink -}} {{- else -}} {{/* Otherwise, use relative link of the image */}} {{- $image = ($image | relURL) -}} {{- end -}} {{- end -}} {{ $linkClass := "hover:border-gray-300 bg-transparent shadow-sm dark:border-neutral-800 hover:bg-slate-50 hover:shadow-md dark:hover:border-neutral-700 dark:hover:bg-neutral-900" }} {{- with $image -}} {{ $linkClass = "hover:border-gray-300 bg-gray-100 shadow dark:border-neutral-700 dark:bg-neutral-800 dark:text-gray-50 hover:shadow-lg dark:hover:border-neutral-500 dark:hover:bg-neutral-700" }} {{- end -}} {{- $external := strings.HasPrefix $link "http" -}} {{- $href := cond (strings.HasPrefix $link "/") ($link | relURL) $link -}} {{- with $image -}} {{ $title }} {{- end -}} {{- $padding := "p-4" -}} {{- with $subtitle -}} {{- $padding = "pt-4 px-4" -}} {{- end -}} {{- with $icon }}{{ partial "utils/icon.html" (dict "name" $icon) -}}{{- end -}} {{- $title -}} {{- with $subtitle -}}
{{- $subtitle | markdownify -}}
{{- end -}}