{{- $img_destination := .Destination -}}
{{- if (and .Page.Site.Params.image_cdn.enable (not .Page.Site.IsServer)) -}}
{{if hasPrefix .Destination "/" }}
{{ $img_destination = (print .Page.Site.Params.image_cdn.HOST .Destination) }}
{{ else if not (hasPrefix .Destination "http") }}
{{ $img_destination = (print .Page.Site.Params.image_cdn.HOST (path.Join .Page.RelPermalink .Destination)) }}
{{ end }}
{{- end -}}
{{- if .Title -}}
{{if .Page.Site.Params.fancybox }}
{{ else }}
{{ end }}
{{ with $.Title | safeHTML }}{{ . }}{{ end }}
{{- else -}}
{{if .Page.Site.Params.fancybox }}
{{ else }}
{{ end }}
{{- end -}}