Website

Hugo - External link


每篇文章下方參考資訊,其連結原本都是用Markdown語法

[Yidti的網誌](https://yidti.github.io/)

但是他們都不會新開分頁,而直接將本分頁進此此連結


設定開啟新分頁的連結

  1. 建立Short code (themes/liva-hugo/layouts/shortcodes)

建立一個新檔案 newtabref.html,輸入以下內容

<a href="{{ .Get "href" }}" rel="noopener" target="_blank">{{ .Get "title" }}</a>
  1. 開啟新分頁的連結寫法

使用shortcode

{{< newtabref href="https://yidti.github.io/" title="Yidti的網誌">}}

未來點開連結就會開啟新分頁摟!

Reference

Hugo external link new tab