How to forward a link to a dynamic page to a standard page

Hi i have a dynamic dataset that populates dynamic pages, but there are a couple pages that are not linked to the dataset that i would like linked to the other dataset.

So dataset a populates this dataset. The chemistrie sunclips links to the second screenshot.

that button goes here

but i really want it to go here - a page thats not part of the dynamic page group but has datasets on it linking to page content.


the question is how to make the link to the dynamic page go directly to another page.

can i technical help here?
visit threedesignviz.com to view the prototype website

I’m not sure I fully understood from what you want to do but if I understood correctly, then here’s a tutorial on how to do it.

Here is the code:

export function YOUR_DATASET_ID_ready() {
 const newData = {
 '_id': 'newButton',
 'title': 'BUTTON TITLE',
 'link-team-title':  'LINK TO PAGE'
    }

 const repeater = $w('#YOUR_REPEATER_ID');
 const repaeterData = repeater.data;
    repeater.data = repaeterData.concat(newData);

    repeater.onItemReady(( $item, itemData) => {
        $item('#BUTTON_ID').label = itemData.NAME_OF_BUTTON_LABEL_IN_DATABASE;
        $item('#BUTTON_ID').link = itemData[`NAME_OF_DYNAMIC_LINK_IN_DATABASE`];
        $item('#BUTTON_ID').target = '_self';
    })

}

ok i would like it to redirect immediately without ever going to the dynamic page. so that users go to the dedicated webpage and not the dynamic webpage.

Watch the video again.
The last button we added leads straight to the page you selected.

Sorry. I just updated and upload the video inside my answer.

@md60th very good tutorial. will try it out and tell you.

Hello @md60th thank you so much for the tutorial and help.


i have followed the directions as much as i could. but now i have a blank button that has no link.

Dataset Name #solutionsdataset
Repeater Name #solutionsrepeater
Button Name #solutionsbutton

///

export function solutionsdataset_ready() {
const newData = {
‘_id’ : ‘newButton’ ,
‘title’ : ‘Chemistrie’ ,
‘link-vision-solutions-1-title’ : ‘https://www.threedesignviz.com/chemistrie
}

const repeater = $w( ‘#solutionsrepeater’ );
const repaeterData = repeater.data;
repeater.data = repaeterData.concat(newData);

repeater.onItemReady(($item, itemData) => { 
    $item( '#solutionsbutton' ).label = itemData.solutionName; 
    $item( '#solutionsbutton' ).link = itemData[`link-vision-solutions- 1 -title`]; 
    $item( '#solutionsbutton' ).target =  '_self' ; 
}) 

}

///

What have we done wrong?

The KEY in the object with the new button information should be the same as the KEY in the database that returns the title to the button.

But because it’s the first button, then it looks like a case where you have an empty row in the database or an untitled row for the button.
If so, delete it or update the title.
Check out the 2 options.

Hi @md60th ive checked it out and yes there was a blank row. i deleted it and published the database and the site. i checked out the debug and found this by the blank button.

[Dataset - Connected] ‘VisionSolutions’ collection to element ‘#solutionsrepeater.#solutionsbutton’:

{…}
json Table Copy JSON

link:
“link-vision-solutions-1-title”

label:
“solutionName”


This is how the regular button looks,

[Dataset - Populated] ‘VisionSolutions’ collection into element ‘#solutionsrepeater.#solutionsbutton’:

{…}
json Table Copy JSON

link:
“/products/supplies”

label:
“Supplies”


So it looks like it should be ״ label״

Perfect. It works! Thanks so much!
So I added an image to the item in the repeater and the image source is pulling from the newdata but now the button isnt.
The button


the image,


So i tried to call the image link and source like:

export function solutionsdataset_ready() {
const newData = {
‘_id’ : ‘newButton’ ,
‘label’ : ‘Chemistrie System’ ,
‘link-vision-solutions-1-title’ : ‘https://www.threedesignviz.com/chemistrie
}

const repeater = $w( ‘#solutionsrepeater’ );
const repaeterData = repeater.data;
repeater.data = repaeterData.concat(newData);

repeater.onItemReady(($item, itemData, $image) => { 
    $item( '#solutionsbutton' ).label = itemData.solutionName; 
    $item( '#solutionsbutton' ).link = itemData[ 'link-vision-solutions-1-title' ]; 
    $item( '#solutionsbutton' ).target =  '_self' ; 
    $image( '#imageX13' ).target =  '_self' ; 
    $image( '#imageX13' ).link = itemData[ 'link-vision-solutions-1-title' ]; 
}) 

}

SOLUTION!

NO CODE NEEDED.

IN YOUR DATASET CREATE A NEW COLUMN

NAME IT SOMETHING SLIGHTLY DIFFERENT TO THE un-editable page url.
set the properties to url.

copy and paste all of the page urls to match the ones in the default column.

for the page you wish to redirect to which is outside the dataset just type or paste the portion of the link after the domain /your-page for example.

then in your repeater change the links to the new column instead of the default page url. Publish the website and preview in the published site, the preview of the custom redirect will not work in the editor. it will have a 404 error.