Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Content & Markdown

All externals links on my pages open in a new tab

Started by thgr 6 years ago · 4 replies · 2362 views
6 years ago

Hello,

I have define my own theme that is inheriting from quark theme.

I would like to know own can I make all externals links on my pages open in a new tab of the navigator. I don't want to write target="_blank" for each link, I don't know if it's possible.

This links are in pages using markdown or html.

Thank you

6 years ago

thank you ! that's it !

👍 1
6 years ago

Good morning all, I hope are all safe and well.

it is possible to open the external link as a new tab?

YAML
---
title: 'Title'
external_url: 'https://www.getgrav.org'?_blank
---

I tried different options, but none of them successful.

thanks in advance
Carlos.

6 years ago

Your link isn't going to work for a couple of reasons. You have closed the quote in the middle of the URL. You don't even need the quotes here. Also, you want your HTML to be <a href="https://www.getgrav.org" target="_blank">...</a>, which needs to come from a Twig template. I think you are getting confused with Grav flavoured Markdown, which offers that shortcut notation.

Are you asking if you can force a new tab rather than a window? No, that level of control isn't offered by browsers to websites. Browsers and user settings determine the behaviour of _blank links.

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 8 months ago
6 99 8 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 186 1 year ago
Content & Markdown · by Jan L'Am, 1 year ago
4 148 1 year ago
Content & Markdown · by Leonardo, 1 year ago
3 62 1 year ago
Content & Markdown · by belthasar, 1 year ago
4 257 1 year ago