
























Many a times we need to open some External Link in New Tab for the convenience of the Visitor . In Hugo there is no default method for this.
All we have in Hugo is relref for Internal sites. :/
Hugo offers a way to render using a predefined template to Markdown(.md) with the help of Shortcodes.
We can create such a shortcode for *Creating an Exeternal link with with target='_blank'.
Create a folder in /layouts named shortcodes/
Create a file named newtabref.html which will act as a templete for our shortcode :=
layouts/
├── _default/
├── partials/
└── shortcodes/
└── newtabref.html <- new file created
<a href="{{ .Get "href" }}" rel="noopener" target="_blank">{{ .Get "title" }}</a>
{{< newtabref href="<YOUR EXTERNAL LINk>" title="<TITLE FOR LINK>" >}}
Thus we have created an External Link With target=’_blank’ In Hugo Markdown !!! :D
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。