Text-link from product page to open specific tab on blog page

Hi everyone,

Similar topics have been covered in this forum, but they’re either closed or over 3 years old.
My case may slightly differ from what’s been discussed here anyway.

I’m trying to link from a description (text-link) on a product page to open the respective, specific blog post page tab. It’s not working for me.

I copied the code provided posted below (exactly as is, no changes) to the site-wide footer custom code field.
I gave the tabs combo classes of “blog-tab-1”, “blog-tab-2” etc.
In the CMS of the respective product I added a text-link with the URL “https://ornament-is-crime.webflow.io/post?tab=blog-tab-1”

What am I doing wrong?
Is it the format of the URL that’s not working?
Can you please help?!

<script>
var Webflow = Webflow || [];
Webflow.push(function () {
  var tabName = getParam('tab');
  if (!tabName) return;

  $('.' + tabName).triggerHandler('click');

  function getParam(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
      results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
  }
});
</script>

My read-only link:
https://preview.webflow.com/preview/ornament-is-crime?utm_medium=preview_link&utm_source=designer&utm_content=ornament-is-crime&preview=67d6cc255726c5fa9db030eebf3f2545&pageId=610c112af103959954fbc359&itemId=610c1199aa7c028c05c505a5&workflow=preview

I’m stuck fiddling with this for days now.
Can anyone help, please?
Thank you!

Hi @Rapha I’m having a little trouble understanding your desired functionality.

Do you want the link X2XOBF.ShouSugiBan in this example to link to a specific blog post?

It looks like you have tabs for blog posts on your blog page. Do you expect to update content in the products and blog posts regularly or is it going to be fairly static?

Sorry, looks like I wasn’t specific enough.

Only (some) text links in the product description will link to the respective blogs.
In that particular example you’re showing it would be the “Poplar” text link in the description and that should link to a specific tab (e.g. blog-tab-1) and open its content (which in this case is the blog post “Poplarism, Fairness in Taxation”).

To your other question:
The blog posts will be populated and edited by the client in the CMS. The content of the blog post may change but the post (the CMS item) will stay (meaning the link URL or tab class won’t change).
They will add more products (with links in the description) and more blog posts over time, but those will follow the same CMS and tab class pattern.

Thank you, Keegan.
Did the answers to your questions and the more detailed explanation I just posted help you understand what I’m trying to do?

I don’t know if it’s of relevance:
I’m using F’inSweets library to work around the WF limitations for the amount of nested collections.

OK. It looks lke you’re using the Finsweet Tabs component as well. have you tried asking in the Finsweet help Slack?

I did contact them via Slack.
So far they couldn’t help me.

I found another solution in that I only use collection lists instead of tabs.
I’d still be curious to learn how to control the order of tabs vs tab content.