Community X.

Connect with other creators, share ideas, give feedback and get the latest product updates.

Mar 7

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

7 answers4 replies
1
Best Answer
Mar 14

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.

1
Mar 7Edited: Mar 11

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.

Kapture 2021-03-07 at 20.52.54
.mp4
Download MP4 • 35.31MB

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';
    })

}

1

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.

Mar 7

Watch the video again.

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

Mar 11

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

Mar 11Edited: Mar 11

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

1
Mar 12Edited: Mar 12

Hello @Matanya 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?

1
Mar 12

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.

1

Hi @Matanya 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':

{...} jsonTableCopy JSON link: "link-vision-solutions-1-title" label: "solutionName"



This is how the regular button looks,


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

{...} jsonTableCopy JSON link: "/products/supplies" label: "Supplies"




Mar 13

So it looks like it should be ״label״


1

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']; }) }



Editor X

Design your boldest creations.