0

我在 Hugo 中使用了以下 render-link.html:

<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if  ( or ( strings.HasPrefix .Destination "http") (strings.HasSuffix .Destination ".pdf")) }} target="_blank"{{ end }}>{{ .Text }}</a>

这有助于在人们单击外部链接(非相对链接)和打开 PDF 时打开一个新选项卡。它在常规页面上效果很好,但在博客文章上却失败了。

它工作的页面(查看最底部的“进一步阅读”部分): https ://www.bridge12.com/learn/dnp-spectroscopy/

不起作用的博客(查看最底部的 http 或 https 链接): https ://www.bridge12.com/blog/2021-06-23-compact-nmr-conference-ii-11-to-13 -2021 年 10 月/

有任何想法吗?

4

0 回答 0