Hugo Shortcodes Library
GitHubToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

New Tab Link

A Hugo shortcode to create new tab links with target="_blank" on the <a > tag.

How to use

# file.md

{{< new_tab_link title="Probably Google" url="https://google.com/" >}} 

Shortcode

# new_tab_link.html

<a href="{{ .Get "url" }}" target="_blank">{{ with .Get "title" }}{{.}}{{else}}{{.Get "url"}}{{end}}</a>

Sample

A link in a sentence that’s Probably Google or something.


Source