Currently, the Answers results open in the same tab. I’m looking for a way to have the results of the answers open in a new tab vs. displaying in the same tab.
Hey Justin,
Check out this unit on Target Behavior of Links. The default behavior of standard cards is to set target
for links to _top
, which opens them in the same tab. You can change this to _blank
to open it in a new tab.
For example, taking a look at the theme standard
card below, you can see the title target
on line 20 and the CTA1 target
on line 38 are both set to linkTarget
, a variable declared on line 15 as either the target set in the runtimeConfig or _top
. You can change this _top
on line 15 to _blank
if you want to keep the option to set the target in the runtimeConfig OR set line 20 and/or 38 to _blank
, depending on which links you want to change.
Hope this helps!
Thank you for that detail and the link. I tried to execute the ‘_blank’ into where stated.
Uploading: Screen Shot 2022-05-23 at 10.19.20 PM.png…
when committing to stage + production, opening in the new tab was unsuccessful. Can you look at the screenshot and see what I’m doing wrong?
Hi Justin,
This change looks right to me and I was able to successfully make this change on another site.
After publishing your commit to the staging and/or production environment, did you hard refresh the staging/production links? This will clear the cache of the page, which could display a previous version of the page instead of the updated one with your changes. Hard refresh by pressing command + shift + R on a Mac or control + F5 on Windows.
If that doesn’t work, I’d recommend changing the target
properties directly.
Hey Kristy,
Thanks for sending that over. By Hard refresh, are you saying on the actually site the answers solution is live or the links in the pages section of the staging and production: Awesome Screenshot
Last question I promise
Hey Justin,
You should hard refresh any of these pages you’re trying to see the updated Answers experience on! If the staging and production environments are published to the latest commit (based on your screenshot, they’re both on the master
branch, so they’re on the latest commit assuming you made these changes on the master
branch), you can hard refresh to see these changes. Additionally, if your live search site uses this production link in the integration, you should see the same update when you hard refresh this site.
Side note - it’s best practice to publish the production environment to a specific commit and NOT the master branch. The reason is - if you’re testing new changes, you may not want those changes to automatically publish to the live site.