Open external link in new tab #193
-
Is there a way to make all EXTERNAL links open in a new tab, and all INTERNAL links open within the same window? Is there any way to make a global change, internal vs. external links? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @kristhayer11, good question. This is something that changed with Hugo and we haven't yet integrated and documented for Quire. It's explained in Hugo’s documentation at https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks, but in short .... In the layouts directory of your project, or in the layouts directory of your project's theme, you'll need to create a new directory called <a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a> This controls how links are rendered from Markdown and there's a bit of logic in there that says that if the link starts with |
Beta Was this translation helpful? Give feedback.
Hi @kristhayer11, good question. This is something that changed with Hugo and we haven't yet integrated and documented for Quire.
It's explained in Hugo’s documentation at https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks, but in short ....
In the layouts directory of your project, or in the layouts directory of your project's theme, you'll need to create a new directory called
_default
and then in that, another new directory called_markup
and then in that, a new file calledrender-link.html
with the following content: