21st February 2025, still a working solution in the “Be Yours” theme. Thanks a lot!
Topic summary
A user needed help configuring external links to open in new tabs within Shopify’s Sense theme (Online Store 2.0). The traditional method for vintage themes didn’t work because Sense lacks a theme.js file in the assets folder.
Solution provided:
- Add JavaScript code to the theme.liquid file
- Wrap the code in
<script></script>tags - The script targets external links and adds the
target="_blank"attribute
Outcome:
The solution successfully resolved the issue. Multiple users confirmed it works across different themes:
- Sense theme (original request)
- Dawn theme (March 2024)
- Be Yours theme (February 2025)
The discussion reached full resolution with a working code snippet that applies site-wide to automatically open external links in new tabs.