Currently I have a Quarto Blog with some icons in the navigation menu, each of them have a hyperlink to another site, but they do not open in another tab, instead they open in the same tab as the blog.
The icons are configured inside the file _quarto.yml
, like this:
navbar:
left:
- icon: stack-overflow
href: https://stackoverflow.com/users/9696037/vin%c3%adcius-f%c3%a9lix
I read the documentation ,
and did some research, I found methods, such as using target = "_blank"
, but I do not know how to configure it inside quarto.
You can use Lua filter to open external links in a new tab:
function Link(link)
if link.target:match '^https?%:' then
link.attributes.target = '_blank'
return link
end
end
The code was shared by @tarleb on Mastodon.
The document on how to use Lua filters in Quarto.