我正在尝试使用Ruby on Rails后端在emberjs中创建产品目录应用程序,以提供所有产品信息。
为了成为一名优秀的SEO公民和整体Google友好,我想在ember中创建非常具有描述性的路线。为此,我选择使用每种产品具有的2个属性。例如,我选择colour
和shape
,因此我想在网址中创建如下所示的路线
www.mysqesomecatalog.com/product/red/square
www.myawesomecatalog.com/producs/square/red
请注意,颜色和形状可以按任意顺序排列,因此要实现这一点,我需要创建两倍的路径来容纳反向对。
到目前为止我所拥有的是过多的路线,如下所示:
this.route('red.square', { path: '/products/red/square' });
this.route('red.circle', { path: '/products/red/circle' });
this.route('blue.square', { path: '/products/blue/square' });
this.route('blue.circle', { path: '/products/blue/circle' });
this.route('square.red', { path: '/products/square/red' });
this.route('circle.red', { path: '/products/circle/red' });
this.route('square.blue', { path: '/products/square/blue' });
this.route('circle.blue', { path: '/products/circle/blue' });
...
...
我可能最终在我的ember路由器中有100条路线,这看起来很傻。有人知道这是否会影响性能?最终有没有更好的方法来实现我想要的目标?
我玩弄了使用动态细分的想法。这听起来更可行吗?