Skip to content

Commit

Permalink
Open external resource links in a new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
jperson1 committed Nov 8, 2024
1 parent f143b68 commit e6c77ca
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/_includes/resources_page.njk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ layout: layout.njk
</p>
</div>
<div class="usa-card__footer padding-top-4">
<a class="usa-button" href="{% if not 'https' in item.data.link %}{{ config.baseUrl}}{% endif %}{{item.data.link}}">
{# If the reference link is local, go right to it with the proper baseUrl. If not, open in a new tab. #}
<a class="usa-button"
{% if not 'https' in item.data.link %}
href="{{ config.baseUrl}}{{item.data.link}}"
{% else %}
href="{{item.data.link}}"
target="_blank"
rel="noopener noreferrer"
{% endif %} >
{% if item.data.link_text %}
{{ item.data.link_text }}
{% else %}
Expand Down

0 comments on commit e6c77ca

Please sign in to comment.