When setting up a Redirect page, it would be great to be able to choose whether the URL should open in the same or a new window.
Ben, this is more of a feature request than a question. Please submit feature requests here.
To answer a question in the comments below, you can always add the target="_blank" attribute to the link itself to open it in a new window. In the case of making a nav item open in a new window, the easiest way to do that would be to first make the page you want to open in a new window the last (or first) item in the navigation bar, and then targeting it with some liquid markup in the _nav.html file, located under Website > Theme > _nav.html.
In my example below, I am choosing to target the last item in the nav by using the {% if forloop.last %} tag and replacing this:
--------
{% if child.is_or_is_ancestor_of_current_page? %}<li class="active{% if forloop.first %}_left{% endif %} {{ child.slug }}">{% else %}<li class="nodrop {{ child.slug }}">{% endif %}
<a href="{{ child.url }}">{{ child.name }}</a>
</li>
{% else %}
{% if child.is_or_is_ancestor_of_current_page? %}<li class="active_drop{% if forloop.first %}_left{% endif %} {{ child.slug }}">{% else %}<li class="drop {{ child.slug }}">{% endif %}
<a href="{{ child.url }}">{{ child.name }}</a>
-------->With this:
{% if child.is_or_is_ancestor_of_current_page? %}<li class="active{% if forloop.first %}_left{% endif %}">{% else %}<li class="nodrop">{% endif %}
<a href="{{ child.url }}" {% if forloop.last %}target="_blank"{% endif %}>{{ child.name }}</a>
</li>
{% else %}
{% if child.is_or_is_ancestor_of_current_page? %}<li class="active_drop{% if forloop.first %}_left{% endif %}">{% else %}<li class="drop">{% endif %}
<a href="{{ child.url }}" {% if forloop.last %}target="_blank"{% endif %}>{{ child.name }}</a>
---
Thanks.
Showing 32 reactions
Sign in with
The whole line of code in _nav.html now reads: <li><a href=“%7B%7B%20child2.url%20%7D%7D” target=“_blank”>{{ child2.name }} </a></li>
Certified Architect
Certified Expert
Certified Developer
Certified Architect
Certified Expert
Certified Developer
{% if child2.type_slug == “redirect” }target="_blank"{ endif %}
Note: “child2” can be “child”, “post”, “page”, etc depending on where your link is.
Tim Wayne
Certified Architect
Certified Expert
-} with {%-%}{% if site.has_button3? }
<a class=“button supporter-nav-button” href=“%7B%7B%20site.button3_page.full_url_with_profile_recruiter%20%7D%7D” target=“_blank”><span>{{ site.button3_text }}</span></a>
{ endif %}
Film and Campaign Ltd.
Certified Architect
“unless redirect target URL contains our site URL”. Don’t think there’s a page variable for the target URL in redirect pages though…
Sandy, it would be helpful if you could explain what you found ‘not helpful’ about my original question.
try adding {% if child.type_name == “Redirect” }target="_blank"{ endif %} inside your <a href> tags</a>
{% if child.type_name == "Redirect" }target="_blank"{ endif %}
innside your
Film and Campaign Ltd.
Certified Architect
Content liquid Tag ‘{%’ was not properly terminated with regexp: /\%\}/
<i>it would be much easier if you had an “open in a new window” tickbox on a Redirect page, especially if one wants to arrange these more flexibly,/i> </i>
Film and Campaign Ltd.
Certified Architect
As you can see, I regularly submit feature requests. Forgive me for posting this under Questions 10 months ago when I was still a newbie.
Would you agree that for the majority of NationBuilder users, it would be much easier if you had an “open in a new window” tickbox on a Redirect page, especially if one wants to arrange these more flexibly.
It should really be quite easy to implement this at your end…?
Film and Campaign Ltd.
Certified Architect
Film and Campaign Ltd.
Certified Architect
Film and Campaign Ltd.
Certified Architect
Film and Campaign Ltd.
Certified Architect
Status key