hugo-toha/layouts/partials/cards/skill.html
Tommy Chu d6706e05ee
Fix redirections to empty tabs (#290)
Whenever href (url) attribute was omitted or had no value
the click action would do nothing. With no URLs defined and
`target="_blank"` attributes, which were recently added,
anchor tags now redirect users to new blank tabs (side effect).

This PR solves the issues by adding conditions
before applying `target="_blank"` or in some cases by
ommiting entire entities (e.g. the view_certificate button).
2021-04-05 22:25:27 +06:00

22 lines
808 B
HTML

<div class="col-xs-12 col-sm-6 col-lg-4 pt-2">
<a class="skill-card-link" href="{{ if .url }}{{ .url }}{{ else }}javascript:void(0){{ end }}" {{ if .url }}target="_blank"{{ end }}>
<div class="card">
<div class="card-head d-flex">
{{ if .logo }}
{{ $logoImage := resources.Get .logo }}
{{/* svg don't support "Fit" operation */}}
{{ if ne $logoImage.MediaType.SubType "svg" }}
{{ $logoImage := $logoImage.Fit "24x24" }}
{{ end }}
<img class="card-img-xs" src="{{ $logoImage.RelPermalink }}" alt="{{ .name }}" />
{{ end }}
<h5 class="card-title">{{ .name }}</h5>
</div>
<div class="card-body">
<p class="card-text">{{ .summary | markdownify }}</p>
</div>
</div>
</a>
</div>