SAP Spartacus裡的路由機制共同有4種:
When Spartacus is launched, the route is handled by the router logic. There are 4 different types of routing that will be evaluated:
(1) the route should be handled by a custom router path; the customer has added hard-coded routes, and we should prioritise those.
(2) the route is either a PLP or PDP
(3) the route is a CMS content page
(4) the route is unknown (404 not found)

如果一個并不存在的url傳遞給Spartacus,會被當成content page處理,Spartacus會使用CMS API去讀取該url對應的content page.
If the CMS cannot find a matching content page, it will respond with a 404 error. Spartacus will handle this 404 error, and redirect the user (under the hood) to the not found CMS page.
如果CMS傳回404錯誤,Spartacus會顯示CMS裡model的not found CMS頁面。
結果:顯示not found頁面
步驟如下:
navigation start:
app.module.ts:115 Jerry: NavigationStart(id: 1, url: ‘powertools-spa/en/USD/jerry’)
第二步:
Jerry: RoutesRecognized(id: 1, url: ‘powertools-spa/en/USD/jerry’, urlAfterRedirects: ‘powertools-spa/en/USD/jerry’, state: Route(url:’’, path:’’) { Route(url:‘jerry’, path:’**’) } )
第三步:
Jerry: GuardsCheckStart(id: 1, url: ‘powertools-spa/en/USD/jerry’, urlAfterRedirects: ‘powertools-spa/en/USD/jerry’, state: Route(url:’’, path:’’) { Route(url:‘jerry’, path:’**’) } )
第四步:
Jerry: ChildActivationStart(path: ‘’)
app.module.ts:115 Jerry: ActivationStart(path: ‘**’)
404錯誤:
id為jerry的content page不存在,但是not-found content page存在: