Don't open hero social link if href is local
In case link for a social icon in the hero image is set to local link (e.g., "#contact"), don't open it in a new tab. It's useful if you don't want to publish a link to your e-mail in clear text, and rather redirect user to the contact form. Signed-off-by: Marek Pikuła <marek@serenitycode.dev>
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
<span>
|
<span>
|
||||||
{{ range .Site.Params.hero.socialLinks.fontAwesomeIcons }}
|
{{ range .Site.Params.hero.socialLinks.fontAwesomeIcons }}
|
||||||
<span class="px-1">
|
<span class="px-1">
|
||||||
<a href="{{ .url }}" target="_blank" class="btn social-icon">
|
<a href="{{ .url }}"
|
||||||
|
{{ if not (hasPrefix .url "#") }} target="_blank" {{ end }}
|
||||||
|
class="btn social-icon"
|
||||||
|
>
|
||||||
<i class="{{ .icon }}"></i>
|
<i class="{{ .icon }}"></i>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
@@ -9,7 +12,10 @@
|
|||||||
|
|
||||||
{{ range .Site.Params.hero.socialLinks.customIcons }}
|
{{ range .Site.Params.hero.socialLinks.customIcons }}
|
||||||
<span class="px-1">
|
<span class="px-1">
|
||||||
<a href="{{ .url }}" target="_blank" class="btn social-icon">
|
<a href="{{ .url }}"
|
||||||
|
{{ if not (hasPrefix .url "#") }} target="_blank" {{ end }}
|
||||||
|
class="btn social-icon"
|
||||||
|
>
|
||||||
<img src="{{ .icon }}">
|
<img src="{{ .icon }}">
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user