24 lines
610 B
JavaScript
24 lines
610 B
JavaScript
|
import { match } from 'path-to-regexp';
|
||
|
// import { resolveRoute } from 'vike/routing'; // eslint-disable-line import/extensions
|
||
|
|
||
|
const path = '/:entityType(channel|network)/:entitySlug/:scope?/:page?';
|
||
|
const urlMatch = match(path, { decode: decodeURIComponent });
|
||
|
|
||
|
export default (pageContext) => {
|
||
|
const matched = urlMatch(pageContext.urlPathname);
|
||
|
|
||
|
if (matched) {
|
||
|
return {
|
||
|
routeParams: {
|
||
|
entityType: matched.params.entityType,
|
||
|
entitySlug: matched.params.entitySlug,
|
||
|
scope: matched.params.scope || 'latest',
|
||
|
page: matched.params.page || '1',
|
||
|
path,
|
||
|
},
|
||
|
};
|
||
|
}
|
||
|
|
||
|
return false;
|
||
|
};
|