Disabling dynamic links from Pro Gallery

I have a Projects page using Pro Gallery, with tiles of Project heroshots. Each of them linked to the Project Details page with pictures managed by a dataset/CMS.

There are few projects that only have a heroshots but no contents in the dataset because they are works in progress, and only shown in the Project Gallery as a teaser/coming soon. Currently, if I click one of those, it jumps to the corresponding Project Details page with no contents.

How can I disable the link for those while keeping other projects enabled? Basically, I want all projects that has pictures to have a link to a corresponding pages, but ones without only show heroshots but no link.

I built this site with Wix Studio Editor.

To achieve this functionality in Wix Studio Editor, you can use custom code with Velo to dynamically enable or disable links based on the presence of content in the dataset for each project

Could you tell me what exact code I can use and where to add? Or places to look at to learn how to write it?

I’d suggest using a data hook. Specifically, the afterQuery() data hook that runs every time you fetch items from the specified database. The code in this can check if there is content available for each item and in case there isn’t, it can replace the dynamic URL with a /# which will basically keep the user on the same page instead of navigating them to a dynamic page. (Or you may remove the link altogether but I’m not sure if that will be the best, bug-free solution).

Note that data hooks work sitewide, meaning any logic that you write using code will run every single time content is fetched from that particular collection from any page on your site.