How do you connect wixLocation.to to a dynamic page or page Url?

Example: wixLocation.to(???) How do I get it from here?

Hey,

If you are trying to connect the element to a dynamic Item page, it will look like this:

wixLocation.to("/collectionID/Title");

Example:

wixLocation.to("/urls/Cat");

Don’t forget to import:

import wixLocation from 'wix-location';

If you are trying to create custom All Items dynamic page, then I’d recommend you to use forEachItem() and link property of the element (e.g. button).

The code should look something like this (inside the forEachItem() ):

$item("#buttonID").link = "/collectionID/"+itemData.Title;

Thanks Anastasiia, I’ll give your suggestions a try. Do you know how I can get the pageUrl from the sample below;