Markdown: Link does not open in new tab

Hi,

I try to write a cookies policy page in my site, and it does some curious. While with the other links to Firefox cookies policy page or Internet Explorer, open with **?target=_blank in a blank tab, with Google policy page doesn’t happen the same.

I’ve write this:

https://support.google.com/chrome/answer/95647?hl=es&ref_topic=3421433?target=_blank

With this link, the page open in the current tab instead the new one.

For example, with the link to Mozilla Support works fine:

https://support.mozilla.org/es/products/firefox/privacy-and-security?target=_blank

What’s wrong?

You can see it in grav.juanvillen.es

Thanks for your help.

Die you try https://support.google.com/chrome/answer/95647?hl=es&ref_topic=3421433&target=_blank ?

@pmoreno The link to Google is malformed.

<a href="https://support.google.com/chrome/answer/95647?hl=es&ref_topic=3421433%3Ftarget%3D_blank">

It should be:

<a href="https://support.google.com/chrome/answer/95647?hl=es&amp;ref_topic=3421433%3F" target="_blank">

Thanks pamtbaau. It’s a pleasure to have your help again

Thanks. Your link is correct too.

Would you mind explaining why a link like

<a href="/path/to/page?target=_blank">Title</a>

should work? I haven’t found any reference to this.

Writing it in the html link won’t work, but Grav picks up the attribute in markdown links:

Ah, your answer refers to creating a link with the target attribute in Markdown…

[Link in new Tab](../some-page?target=_blank)

That wasn’t clear to me…

This link doesn’t work in markdown format. I think that is so because the link has two ‘?’ character, but I’m not sure.

However, if I write the link like you say above, using the <a> tag, it works fine.

@pmoreno Note the syntax of query strings:

  1. There can only be one ? in the url. It separates the path from the query string.
  2. Separate the second, third, and any subsequent parameters with &

Not working due to incorrect querystring:

Markdown : [My link](/path/to/page?param1=value1?target=_blank)
Generates: <a href="/path/to/page?param1=value1%3Ftarget%3D_blank">My link</a>

Working:

Markdown : [My link](/path/to/page?param1=value1&target=_blank)
Generates: <a href="/path/to/page?param1=value1" target="_blank">My link</a>

Kind request to edit and improve your question for clarity:

  • The question would be more clear if you explicitly showed the context of the urls shown: Show the entire markdown, or <a> you used.
  • And while you’re at it, a better title could be “Markdown link not showing in new tab”
1 Like

Hi,

@pamtbaau, thaks again. At first of all, I’d like to inlcude the complete markdown code about the link to google page, referred in this post:

Code with <a> tag (works fine):

<a href="https://support.google.com/chrome/answer/95647?hl=es&amp;ref_topic=3421433%3F" target="_blank"> soporte de Google</a> o la Ayuda del navegador.

Code with your last solution (works fine, but it’s more clear):

[soporte de Google](https://support.google.com/chrome/answer/95647?hl=es&amp;ref_topic=3421433%3F&target=_blank)

Finally, you’re right when you say that the title of post isn’t very clear, but I can’t to change it now. If you want and you can change it, do it, no problem.

Thanks for all.

your link is working thank you