{{ $class := .Get "class" -}} {{ $newtab := .Get "newtab" | default false -}} {{ $src := .Get "src" -}} {{ $text := .Get "text" -}} {{ if and $src (fileExists (add "/assets" $src)) -}} {{ $original := resources.Get $src -}} {{ $src = $original.RelPermalink -}} {{ end -}} {{ if not $text -}} {{ $text = path.Base $src -}} {{ end -}} {{ $text }}