[HELP] Redirection for multiple dynamic pages

Hey there … I resign, I can’t figure how to properly configure a redirect using a Hook and a Router so I’m here to ask for help.

The situation: On my website I share two types of Resources: 3D models and Video tutorials using dynamic pages. I am using a repeater as a menu and each resource type has its own Item dynamic page/template with the following link system:

VideoResources page= www…/resources/{Type}/{Title}/{Subtitle}
3DResources page = www…/resources/{Type}/{Title}

The problem: The repeater always leads to the 3DResources page, whether it’s a video or a 3D model.
Here is the link to the online Resources Menu if it helps to understand the issue:
www.ligotcorentin .com/resources

The supposed solution: I figured out that I need to set up a Router to redirect the user to the VideoResources page whenever the dynamic URL contains the {type} video .

What i did: Inspired by the AfterRouter() example I created a Hook on my Resources Menu page from the Menu and page parameters box with the following code:

//inside router.js
import {ok} from 'wix-router';
export function resources_afterRouter(request, response) {
 if(response.path === "video") {
 return ??????;}
 else
 return response;
  }

But I have no idea what should I write in the Return section, how to configure the correct return link or even if I need to set up anything anywhere else …

Regarding my URL system, the rooter should work this way:

  • Reading the requested URL
  • Detecting the “Video” Type in the .path
  • Add the /{Subtitle} to the destination URL
  • Redirect the user to this URL
    Can you help me to make it works this way please?

Thank you in advance for any help you can give me and I remain available to give all the information you need.
Best regards

UP