The nav framework will capture the undefined path elements and route them to the first defined view in your frame nav definition.
the currentUrlMatchedAgainst
property of the framegetparams
may be used to achieve this goal.
We should define the browse
as the first view:
{
path: 'browse/.*',pattern: {
matches: ['querystring']},
views: {body: modtask.ldmod('kernel/path').rel('browse')
}}
The definition will result in the following behavior in the browse
view :
Path currentUrlMatchedAgainst matches
mydomain.com/blog "" {}
mydomain.com/blog/ "" {}mydomain.com/blog/123 123 {}
mydomain.com/browse browse {}mydomain.com/browse/ browse/ {}
mydomain.com/browse/1 browse/1 { querystring: 1 }So we can just write a simple logical expression to decide on a 301 redirect or staying on and showing the data. You may refer to the part1 of the series to see how.
Please refer to izyware/viewer/blog/browse/frame
for details.
Always verify the redirects by using the [MetaScope] app. It will help you verify:
1) The redirected page has the correct meta values (in the perspectives tab)
2) The 301 status gets sent (in the http headers tab)If you find issues and need to debug the server side behavior, you can always use the izy-circus
command line interface:
node cli.js method render bootstrapUrl https://izyware.com/chrome_extension.js entrypoint izyware:viewer/top uri /blog/create-seo-friendly-and-crawlable-single-page-izyware-apps domain izyware.com renderingVersion 2 cache.folder /tmp/izy-circus/