浏览代码

feat: add Markdown render hook to parse links

Adds support for opening external links in new tabs in Hugo v0.62+.

BREAKING CHANGE:
Requires Hugo v0.62

See #1514
George Cushen 5 年之前
父节点
当前提交
db716b2349
共有 3 个文件被更改,包括 4 次插入2 次删除
  1. 2 0
      layouts/_default/_markup/render-link.html
  2. 1 1
      netlify.toml
  3. 1 1
      theme.toml

+ 2 - 0
layouts/_default/_markup/render-link.html

@@ -0,0 +1,2 @@
+{{/* A Hugo Markdown render hook to parse links, opening external links in new tabs. */}}
+<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a>

+ 1 - 1
netlify.toml

@@ -5,7 +5,7 @@
 
 [build.environment]
   HUGO_THEME = "repo"
-  HUGO_VERSION = "0.60.1"
+  HUGO_VERSION = "0.62.2"
   HUGO_ENABLEGITINFO = "true"
 
 [context.production.environment]

+ 1 - 1
theme.toml

@@ -3,7 +3,7 @@ license = "MIT"
 licenselink = "https://github.com/gcushen/hugo-academic/blob/master/LICENSE.md"
 description = "The website builder for Hugo. Build *anything* with widgets and deploy with one click! Fully personalize your site with themes, plugins, and language packs."
 homepage = "https://sourcethemes.com/academic/"
-min_version = "0.60"
+min_version = "0.62"
 tags = ["widgets",
         "resume",
         "portfolio",