Open All Links in the Current Tab - Minimal Theme

I’ve been searching for weeks, but I haven’t found a solution for what I want to do. I’m trying to setup my store so that all links in the navigation menu in the header and the footer all open in the current tab. Currently, internal links open in the current tab, but external links open in a new tab. The store is a subdomain of my main website and they share some of the same links. I’m trying to make it feel like one website, but it gets confusing for customers when some pages open in the current tab and others open in a new tab. Eventually, customers could easily have 4 or 5 tabs open with no back button functionality. All links opening in the current tab would solve everything.

I’m using the Minimal Theme that has been customized quite a lot to somewhat match my main website. So, I’m comfortable with editing code, etc. The links to both sites are:

I would appreciate and help our suggestions in regards to a solution to my problem.

Many thanks!

1 Like

You can try this code by following these steps:
Step 1: Go to the online store ->Theme ->Edit Code.
Step 2: Find the header.liquid file and the footer.liquid file. Remove the target attribute of the tag

AnneLuo_0-1724801768435.png

The link will open in the current tab after being removed.
Hopefully it will help you. If yes then Please don’t forget hit Like and Mark it as solution!

Thank you for the reply.

If I “inspect” the page via Google Chrome I have found the link that you screenshot. However, when looking at the header.liquid and footer.liquid the html links are not shown so I can’t edit them. I’ll post the header and footer.

HEADER

{%- assign logo_width = 695 -%} {%- assign logo_max_width = section.settings.logo_max_width | times: 1 -%} {% if logo_max_width < logo_width %} {%- assign logo_width = logo_max_width -%} {% endif %} .logo__image-wrapper { max-width: {{ logo_width }}px; } /*================= If logo is above navigation ================== */ {% if section.settings.nav_below_logo %} .site-nav { {% if section.settings.show_header_lines %} border-top: 1px solid {{ settings.color_borders }}; border-bottom: 1px solid {{ settings.color_borders }}; {% endif %} margin-top: 30px; } {% unless section.settings.left_aligned_logo %} .logo__image-wrapper { margin: 0 auto; } {% endunless %} {% endif %} /*============ If logo is on the same line as navigation ============ */ {% unless section.settings.nav_below_logo or section.settings.show_header_lines == false %} .site-header .grid--full { border-bottom: 1px solid {{ settings.color_borders }}; padding-bottom: 30px; } {% endunless %} {% unless section.settings.nav_below_logo %} @media screen and (min-width: 769px) { .site-nav { text-align: right!important; } } {% endunless %}

{% if section.settings.show_announcement or section.settings.header_search_enable %}

{% comment %}
Add social links to header
{% endcomment %}

{% comment %}

{% include 'social-links' %}
{% endcomment %}

{% if section.settings.show_announcement %}

{% elsif section.settings.header_search_enable %}
{% include 'search-bar' with 'header' %}
{% endif %}
{% endif %}

{% if shop.customer_accounts_enabled %}

    {% if customer %}
  • {{ 'layout.customer.account' | t }}
  • {{ 'layout.customer.log_out' | t | customer_logout_link }}
  • {% else %}
  • {{ 'layout.customer.log_in' | t | customer_login_link }}
  • {{ 'layout.customer.or' | t }}
  • {{ 'layout.customer.create_account' | t | customer_register_link }}
  • {% endif %}
{% endif %}

{% if section.settings.header_search_enable %}
{% if section.settings.show_announcement %}

{% include 'search-bar' with 'header' %}
{% endif %} {% endif %}
{% if section.settings.show_announcement %} {% if section.settings.announcement_link != blank %} {% endif %} {{ section.settings.header_text | escape }} {% if section.settings.announcement_link != blank %} {% endif %} {% endif %}
{% unless section.settings.nav_menu == blank and section.settings.header_search_enable == false and shop.customer_accounts_enabled == false %} {{ 'layout.navigation.menu' | t }} {% endunless %} {{ 'layout.cart.title' | t }} {{ cart.item_count }}
{% include 'mobile-nav' with linklists[section.settings.nav_menu] %}

{% if section.settings.nav_below_logo %}

{% if request.page_type == 'index' %}

{% else %}
{% endif %} {% if section.settings.logo != blank %} {% capture image_size %}{{ logo_width | escape }}x{% endcapture %}
{{ section.settings.logo | img_url: image_size | img_tag: shop.name }}
{% else %} {{ shop.name }} {% endif %} {% if request.page_type == 'index' %}

{% else %}
{% endif %}
{% include 'site-nav' with linklists[section.settings.nav_menu] %}
{% else %}
{% if request.page_type == 'index' %}

{% else %}
{% endif %} {% if section.settings.logo != blank %} {% capture image_size %}{{ logo_width | escape }}x{% endcapture %}
{{ section.settings.logo | img_url: image_size | img_tag: shop.name }}
{% else %} {{ shop.name }} {% endif %} {% if request.page_type == 'index' %}

{% else %}
{% endif %}
{% include 'site-nav' with linklists[section.settings.nav_menu] %}
{% endif %}

FOOTER

{% if settings.social_twitter_link != blank or settings.social_facebook_link != blank or settings.social_pinterest_link != blank or settings.social_google_plus_link != blank or settings.social_instagram_link != blank or settings.social_snapchat_link != blank or settings.social_tumblr_link != blank or settings.social_youtube_link != blank or settings.social_vimeo_link != blank or settings.social_fancy_link != blank or settings.social_rss_link != blank %}
{% assign show_social_icons = true %}
{% else %}
{% assign show_social_icons = false %}
{% endif %}

{% case section.blocks.size %}
{% when 0 %}
{% when 1 %}
{% assign column_width = ‘text-center’ %}
{%- assign article_width = 480 -%}
{% when 2 %}
{% assign column_width = ‘post-large–one-half medium–one-half’ %}
{%- assign article_width = 480 -%}
{% when 3 %}
{% assign column_width = ‘post-large–one-third medium–one-third’ %}
{%- assign article_width = 435 -%}
{% when 4 %}
{% assign column_width = ‘post-large–one-quarter medium–one-half’ %}
{%- assign article_width = 410 -%}
{% when 5 %}
{% assign column_width = ‘post-large–one-fifth medium–one-half’ %}
{%- assign article_width = 335 -%}
{% when 6 %}
{% assign column_width = ‘post-large–one-sixth medium–one-half’ %}
{%- assign article_width = 335 -%}
{% endcase %}

{% for block in section.blocks %}
{% case block.type %}
{% when ‘blog’ %}

{% assign blog = blogs[block.settings.blog] %}

{{ 'layout.footer.blog_title' | t }}

{% assign article = blogs[block.settings.blog].articles.first %}

{{ article.title | link_to: article.url }}

{% if article.image %} {% capture img_id %}ArticleImage-{{ section.id }}--{{ article.image.id }}{% endcapture %} {% capture wrapper_id %}ArticleImageWrapper-{{ section.id }}--{{ article.image.id }}{% endcapture %} {%- assign img_url = article.image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%} {%- assign image_alt = article.title | escape -%} {% include 'image-style' with image: article.image, width: article_width, height: 480, wrapper_id: wrapper_id, img_id: img_id %}

{{ image_alt }}

{{ article | img_url: 'large' | img_tag: image_alt, 'article__image' | link_to: article.url }}

{% endif %} {% if article.excerpt.size > 0 %}
{{ article.excerpt }}
{% else %}

{{ article.content | strip_html | truncatewords: 30 }}

{% endif %}

{% when ‘menu’ %}

{% unless num_columns == 1 %}

{{ block.settings.menu_title | escape }}

{% endunless %}
    {% for link in linklists[block.settings.menu].links %}
  • {{ link.title }}
  • {% endfor %}

{% when ‘social’ %}

{{ 'layout.footer.social_title' | t }}

{% comment %} Loop through the social network links {% endcomment %} {% include 'social-links' %}

{% when ‘text’ %}

{{ block.settings.title | escape }}

{{ block.settings.richtext }}

{% when ‘newsletter’ %}

{{ 'layout.footer.newsletter_title' | t }}

{% unless block.settings.subtext == blank %} {{ block.settings.subtext }} {% endunless %} {% include 'newsletter-form' %}

{% endcase %}
{% endfor %}


{{ 'layout.footer.copyright' | t }} © {{ 'now' | date: '%Y' }}, {{ shop.name | link_to: routes.root_url }}. {{ powered_by_link }}

{% if section.settings.show_methods_of_payment %}
{% unless shop.enabled_payment_types == empty %}

{{ 'general.payment.method' | t }}
    {% for type in shop.enabled_payment_types %}
  • {{ type | payment_type_svg_tag: class: 'icon' }}
  • {% endfor %}
{% endunless %} {% endif %}

Thanks!