Can't link an image in a repeater to a specific dynamic page?

Hi, I have looked through loads of forums that cover this issue but really struggling to get it to work.
I managed to get the project images in my portfolio repeater to take you to the dynamic page that was specific to that project, but once it loaded within a few seconds it would refresh and then change the items on the page always to the exact same project no matter which project I click on in the repeated.
My code is below, I lost some of the stuff i worked on yesterday so now the image link isn’t working anymore. could you help me please?

import wixData from ‘wix-data’ ;
import wixLocation from ‘wix-location’ ;

$w( "#repeater1" ).onItemReady(($w, dataItem, index) => { 

let linkToDynamicPage = dataItem[ “link-portfolio-title” ];
$w( ‘#image1’ ).onClick(() => {;

First, I don’t see the $w.onReady() in your code. All your code except the import’s has to be inside:

$w.onReady(() => {

Second, instead of:

($w, dataItem, index) 

It’s a better practice to use:

($i, dataItem, index) 

and in accordance:

  • on the editor, click the image settings and set it to: “When image is clicked do nothing”

Thank you so much! all working