score:0

you can use ctx.resolvedurl. it will either return what you want or you'll be able parse the needed part out

score:1

since your dynamic page is called [id].jsx, you can access that id in your getserversideprops with: context.params.id.

export function getserversideprops(context) {
    return {
        props: {id: context.params.id},
    }
}

then in your component:

export default function global({ id }) {
   console.log(id);
    ...

}

you can also access it using router object that comes from next.js' userouter hook:

export default function global() {
   const router = userouter();
   const { id } = router.query;
   console.log(id);
    ...

}

Related Query

More Query from same tag