Skip to content

Commit

Permalink
feat: add Markdown render hook to parse links
Browse files Browse the repository at this point in the history
Adds support for opening external links in new tabs in Hugo v0.62+.

BREAKING CHANGE:
Requires Hugo v0.62

See #1514
  • Loading branch information
gcushen committed Jan 11, 2020
1 parent d995e4d commit db716b2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions 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>
2 changes: 1 addition & 1 deletion netlify.toml
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion theme.toml
Expand Up @@ -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",
Expand Down

0 comments on commit db716b2

Please sign in to comment.