Skip to main content

How do I add a target="_blank" to a page-of-type-redirect?

Greetings!

I have a client with a Flickr photo gallery. They have a redirect link in the top nav of their nation which goes right to the gallery. It is an established design pattern for links to external sites open that external page in a new window or tab. My client wants to follow suit. 

I am unable to figure out this option from the CRM: 

So, what's the secret? How do I add a target="_blank" to redirects? 

Official response from

As Austin mentioned in the comments below, you can go into the _nav.html file of your website theme and wrap all of the liquid variables for links in "IF" statements that check to see what page type they are. For example:

Before:

<a href="{{ child.url }}">{{ child.name }}</a>

After

<a href="{{ child.url }}" {% if child.type_slug == 'redirect' %}target="_blank" {% endif %}>{{ child.name }}</a>

 

This will make sure that any redirect pages in the Top Nav open in a new tab. You can also make this change in other places throughout your theme. For example, to achieve the same result in your sidebar, you can edit the _supporter_nav.html file and the _columns_2.html file.

Share this post

Showing 3 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.