[Solved] Cannot get #element to link to dynamic page!

Okay, slowly I started to understand what I was doing. The successful code was as follows:


import wixLocation from 'wix-location';
import wixData from 'wix-data';

$w.onReady(function () {
        $w('#postrepeater').onItemReady( ($item,dataItem,index) => {

let linkToDynamicPage = dataItem['link-projects-title'];

    console.log("Link to page is =", linkToDynamicPage);

            $item('#posthoverbox').onClick(() => {
                wixLocation.to(`${linkToDynamicPage}`);
            });
    })  
});

And it returns the following in the console, and successfully links to the dynamic pages.

Link to page is = /projects/zero-carbon-world

Link to page is = /projects/desert-wildlife-conservation

Link to page is = /projects/renewable-energy-program

Link to page is = /projects/rainforest-action-initiative