import { match } from 'path-to-regexp'; const path = '/admin/:section/:domain(actors)'; const urlMatch = match(path, { decode: decodeURIComponent }); export default (pageContext) => { const matched = urlMatch(pageContext.urlPathname); if (matched) { return { routeParams: { section: matched.params.section, domain: matched.params.domain, }, }; } return false; };